From 8acc2ec9f633168a3c04ac7aa112c1b12218d7cc Mon Sep 17 00:00:00 2001
From: Vadim ProductEngine <vsavchuk@productengine.com>
Date: Mon, 6 Dec 2010 15:01:36 +0200
Subject: [PATCH] STORM-690 FIXED Underlying panels were visible in undocked
 sidepanels.

By the way, fixed losing focus when switching between panels in Me and Places SP (which made the floater semi-transparent).
---
 indra/newview/llpanellandmarkinfo.cpp |  6 ++++++
 indra/newview/llpanelpicks.cpp        |  2 +-
 indra/newview/llpanelprofile.cpp      | 16 ++++++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 87acd83b23b..c57746ec00a 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -180,6 +180,9 @@ void LLPanelLandmarkInfo::setInfoType(EInfoType type)
 
 	populateFoldersList();
 
+	// Prevent the floater from losing focus (if the sidepanel is undocked).
+	setFocus(TRUE);
+
 	LLPanelPlaceInfo::setInfoType(type);
 }
 
@@ -330,6 +333,9 @@ void LLPanelLandmarkInfo::toggleLandmarkEditMode(BOOL enabled)
 		// when it was enabled/disabled we set the text once again.
 		mNotesEditor->setText(mNotesEditor->getText());
 	}
+
+	// Prevent the floater from losing focus (if the sidepanel is undocked).
+	setFocus(TRUE);
 }
 
 const std::string& LLPanelLandmarkInfo::getLandmarkTitle() const
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index ccef5635444..4f4b828cca1 100644
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -781,7 +781,7 @@ void LLPanelPicks::showAccordion(const std::string& name, bool show)
 
 void LLPanelPicks::onPanelPickClose(LLPanel* panel)
 {
-	panel->setVisible(FALSE);
+	getProfilePanel()->closePanel(panel);
 }
 
 void LLPanelPicks::onPanelPickSave(LLPanel* panel)
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 4e635639792..6038ab20d85 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -217,6 +217,10 @@ void LLPanelProfile::setAllChildrenVisible(BOOL visible)
 
 void LLPanelProfile::openPanel(LLPanel* panel, const LLSD& params)
 {
+	// Hide currently visible panel (STORM-690).
+	setAllChildrenVisible(FALSE);
+
+	// Add the panel or bring it to front.
 	if (panel->getParent() != this)
 	{
 		addChild(panel);
@@ -243,6 +247,18 @@ void LLPanelProfile::closePanel(LLPanel* panel)
 	if (panel->getParent() == this) 
 	{
 		removeChild(panel);
+
+		// Make the underlying panel visible.
+		const child_list_t* child_list = getChildList();
+		if (child_list->size() > 0)
+		{
+			child_list->front()->setVisible(TRUE);
+			child_list->front()->setFocus(TRUE); // prevent losing focus by the floater
+		}
+		else
+		{
+			llwarns << "No underlying panel to make visible." << llendl;
+		}
 	}
 }
 
-- 
GitLab