From a8b5da9a70936923e650bd5c200276da49106784 Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine <vsavchuk@productengine.com>
Date: Thu, 14 Oct 2010 18:01:51 +0300
Subject: [PATCH] STORM-211 FIXED Only the hovered toasts now persists until
 you move mouse away (all toasts used to freeze).

---
 indra/newview/llscreenchannel.cpp | 40 ++++++++++---------------------
 indra/newview/llscreenchannel.h   |  8 +++----
 indra/newview/lltoast.cpp         |  1 +
 3 files changed, 17 insertions(+), 32 deletions(-)

diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 5c923a0409..18c9ac28c1 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -253,8 +253,8 @@ void LLScreenChannel::addToast(const LLToast::Params& p)
 	if(mControlHovering)
 	{
 		new_toast_elem.toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2));
-		new_toast_elem.toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopFadingToasts, this));
-		new_toast_elem.toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startFadingToasts, this));
+		new_toast_elem.toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopFadingToast, this, new_toast_elem.toast));
+		new_toast_elem.toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startFadingToast, this, new_toast_elem.toast));
 	}
 	
 	if(show_toast)
@@ -339,7 +339,6 @@ void LLScreenChannel::deleteToast(LLToast* toast)
 	if(mHoveredToast == toast)
 	{
 		mHoveredToast  = NULL;
-		startFadingToasts();
 	}
 
 	// close the toast
@@ -698,38 +697,23 @@ void LLScreenChannel::closeStartUpToast()
 	}
 }
 
-void LLNotificationsUI::LLScreenChannel::stopFadingToasts()
+void LLNotificationsUI::LLScreenChannel::stopFadingToast(LLToast* toast)
 {
-	if (!mToastList.size()) return;
+	if (!toast || toast != mHoveredToast) return;
 
-	if (!mHoveredToast) return;
-
-	std::vector<ToastElem>::iterator it = mToastList.begin();
-	while (it != mToastList.end())
-	{
-		ToastElem& elem = *it;
-		elem.toast->stopFading();
-		++it;
-	}
+	// Pause fade timer of the hovered toast.
+	toast->stopFading();
 }
 
-void LLNotificationsUI::LLScreenChannel::startFadingToasts()
+void LLNotificationsUI::LLScreenChannel::startFadingToast(LLToast* toast)
 {
-	if (!mToastList.size()) return;
-
-	//because onMouseLeave is processed after onMouseEnter
-	if (isHovering()) return;
-
-	std::vector<ToastElem>::iterator it = mToastList.begin();
-	while (it != mToastList.end())
+	if (!toast || toast == mHoveredToast)
 	{
-		ToastElem& elem = *it;
-		if (elem.toast->getVisible())
-		{
-			elem.toast->startFading();
-		}
-		++it;
+		return;
 	}
+
+	// Reset its fade timer.
+	toast->startFading();
 }
 
 //--------------------------------------------------------------------------
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h
index 6cf6d97550..a1fdd6e32c 100644
--- a/indra/newview/llscreenchannel.h
+++ b/indra/newview/llscreenchannel.h
@@ -193,11 +193,11 @@ public:
 	void		closeStartUpToast();
 
 
-	/** Stop fading all toasts */
-	virtual void stopFadingToasts();
+	/** Stop fading given toast */
+	virtual void stopFadingToast(LLToast* toast);
 
-	/** Start fading all toasts */
-	virtual void startFadingToasts();
+	/** Start fading given toast */
+	virtual void startFadingToast(LLToast* toast);
 
 	// get StartUp Toast's state
 	static bool	getStartUpToastShown() { return mWasStartUpToastShown; }
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index a9ab98da5f..c3090cb1fc 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -102,6 +102,7 @@ LLToast::LLToast(const LLToast::Params& p)
 	if(!p.on_delete_toast().empty())
 		mOnDeleteToastSignal.connect(p.on_delete_toast());
 
+	// *TODO: This signal doesn't seem to be used at all.
 	if(!p.on_mouse_enter().empty())
 		mOnMouseEnterSignal.connect(p.on_mouse_enter());
 }
-- 
GitLab