From b6a39ffa214dea8045a768bcfd83f2e1cab13c9b Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Tue, 14 Sep 2010 23:28:19 +0300
Subject: STORM-155 Fixed attempt to show an invisible sidebar tab.

Reason: when you detach the bottommost sidebar tab, the fake open/close tab gets selected, which is invisible.
Fix: select a normal, visible tab.
---
 indra/newview/llsidetray.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

(limited to 'indra/newview/llsidetray.cpp')

diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 88e37b815f..b0914eee69 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -762,8 +762,15 @@ bool LLSideTray::removeTab(LLSideTrayTab* tab)
 	// Deselect the tab.
 	if (mActiveTab == tab)
 	{
-		child_vector_iter_t next_tab_it =
-				(tab_it < (mTabs.end() - 1)) ? tab_it + 1 : mTabs.begin();
+		// Select the next tab (or first one, if we're removing the last tab),
+		// skipping the fake open/close tab (STORM-155).
+		child_vector_iter_t next_tab_it = tab_it;
+		do
+		{
+			next_tab_it = (next_tab_it < (mTabs.end() - 1)) ? next_tab_it + 1 : mTabs.begin();
+		}
+		while ((*next_tab_it)->getName() == "sidebar_openclose");
+
 		selectTabByName((*next_tab_it)->getName(), true); // Don't hide the tab being removed.
 	}
 
-- 
cgit v1.2.3


From 9a996978dd1a33a6b23e92e413ae06dc60ec6228 Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Wed, 15 Sep 2010 23:48:46 +0300
Subject: STORM-157 FIXED A tab might be highlighted while SB was collapsed.

Made sure that a tab can only be highlighted when sidebar is expanended.
---
 indra/newview/llsidetray.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'indra/newview/llsidetray.cpp')

diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index b0914eee69..9ee504cc4c 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -568,8 +568,9 @@ void LLSideTray::toggleTabButton(LLSideTrayTab* tab)
 	{
 		LLButton* btn = it->second;
 		bool new_state = !btn->getToggleState();
-		btn->setToggleState(new_state); 
-		btn->setImageOverlay( new_state ? tab->mImageSelected : tab->mImage );
+		btn->setToggleState(new_state);
+		// Only highlight the tab if side tray is expanded (STORM-157).
+		btn->setImageOverlay( new_state && !getCollapsed() ? tab->mImageSelected : tab->mImage );
 	}
 }
 
-- 
cgit v1.2.3