From 30527b2206e7fce2890c3c44825ff0bef85aa5a0 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Tue, 18 Oct 2011 14:09:52 -0700
Subject: [PATCH] EXP-1409 FIX WASD controls don't move avatar while Move
 floater is in focus moved "chrome" flags to xui separated hiding floater
 title from setting chrome toolbar toggle button now moves floaters to
 frontmost and doesn't necessarily rely on focus

---
 indra/llui/llfloater.cpp                      | 22 ++++++-------------
 indra/llui/llfloater.h                        |  4 ++--
 indra/llui/llfloaterreg.cpp                   |  8 +++----
 indra/newview/llcallfloater.cpp               |  4 ----
 indra/newview/llfloatercamera.cpp             |  2 --
 indra/newview/llfloaterhud.cpp                |  8 -------
 indra/newview/llfloatermap.cpp                |  3 ---
 indra/newview/llfloatersounddevices.cpp       |  3 ---
 indra/newview/lltoastnotifypanel.cpp          |  2 --
 .../skins/default/xui/en/floater_camera.xml   |  1 +
 .../skins/default/xui/en/floater_hud.xml      |  1 +
 .../skins/default/xui/en/floater_map.xml      |  1 +
 .../skins/default/xui/en/floater_moveview.xml |  1 +
 .../default/xui/en/floater_sound_devices.xml  |  1 +
 .../default/xui/en/floater_voice_controls.xml |  1 +
 .../default/xui/en/panel_notification.xml     |  2 ++
 16 files changed, 21 insertions(+), 43 deletions(-)

diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index d1d840729d6..869ad4410b0 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -174,6 +174,7 @@ LLFloater::Params::Params()
 	save_rect("save_rect", false),
 	save_visibility("save_visibility", false),
 	can_dock("can_dock", false),
+	show_title("show_title", true),
 	open_positioning("open_positioning", LLFloaterEnums::OPEN_POSITIONING_NONE),
 	specified_left("specified_left"),
 	specified_bottom("specified_bottom"),
@@ -1142,10 +1143,6 @@ void LLFloater::setMinimized(BOOL minimize)
 			mButtonsEnabled[BUTTON_RESTORE] = TRUE;
 		}
 
-		if (mDragHandle)
-		{
-			mDragHandle->setVisible(TRUE);
-		}
 		setBorderVisible(TRUE);
 
 		for(handle_set_iter_t dependent_it = mDependents.begin();
@@ -1296,19 +1293,9 @@ void LLFloater::setIsChrome(BOOL is_chrome)
 		mButtons[BUTTON_CLOSE]->setToolTip(LLStringExplicit(getButtonTooltip(Params(), BUTTON_CLOSE, is_chrome)));
 	}
 	
-	// no titles displayed on "chrome" floaters
-	if (mDragHandle)
-		mDragHandle->setTitleVisible(!is_chrome);
-	
 	LLPanel::setIsChrome(is_chrome);
 }
 
-void LLFloater::setTitleVisible(bool visible)
-{
-	if (mDragHandle)
-		mDragHandle->setTitleVisible(visible);
-}
-
 // Change the draw style to account for the foreground state.
 void LLFloater::setForeground(BOOL front)
 {
@@ -1812,7 +1799,7 @@ void LLFloater::draw()
 		{
 			drawChild(mButtons[i]);
 		}
-		drawChild(mDragHandle);
+		drawChild(mDragHandle, 0, 0, TRUE);
 	}
 	else
 	{
@@ -2991,6 +2978,11 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
 	{
 		setCloseCallback(initCommitCallback(p.close_callback));
 	}
+
+	if (mDragHandle)
+	{
+		mDragHandle->setTitleVisible(p.show_title);
+	}
 }
 
 boost::signals2::connection LLFloater::setMinimizeCallback( const commit_signal_t::slot_type& cb ) 
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 8beb11507e1..f610b04e352 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -128,7 +128,8 @@ class LLFloater : public LLPanel
 								save_rect,
 								save_visibility,
 								save_dock_state,
-								can_dock;
+								can_dock,
+								show_title;
 		
 		Optional<LLFloaterEnums::EOpenPositioning>	open_positioning;
 		Optional<S32>								specified_left;
@@ -209,7 +210,6 @@ class LLFloater : public LLPanel
 	std::string		getTitle() const;
 	void			setShortTitle( const std::string& short_title );
 	std::string		getShortTitle() const;
-	void			setTitleVisible(bool visible);
 	virtual void	setMinimized(BOOL b);
 	void			moveResizeHandlesToFront();
 	void			addDependentFloater(LLFloater* dependent, BOOL reposition = TRUE);
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index 0edfc8da2d4..df3cff9968f 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -462,16 +462,16 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD&
 	else if (instance->isMinimized())
 	{
 		instance->setMinimized(FALSE);
-		instance->setFocus(TRUE);
+		instance->setVisibleAndFrontmost();
 	}
 	else if (!instance->isShown())
 	{
 		instance->openFloater(key);
-		instance->setFocus(TRUE);
+		instance->setVisibleAndFrontmost();
 	}
-	else if (!instance->hasFocus() && !instance->getIsChrome())
+	else if (!instance->isFrontmost())
 	{
-		instance->setFocus(TRUE);
+		instance->setVisibleAndFrontmost();
 	}
 	else
 	{
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index cc2a189b762..5ad2a560bcf 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -151,10 +151,6 @@ BOOL LLCallFloater::postBuild()
 
 	connectToChannel(LLVoiceChannel::getCurrentVoiceChannel());
 
-	setIsChrome(true);
-	//chrome="true" hides floater caption 
-	if (mDragHandle)
-		mDragHandle->setTitleVisible(TRUE);
 	updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
 	
 	updateSession();
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index 71077f59166..b33dea4890f 100644
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -353,8 +353,6 @@ LLFloaterCamera::LLFloaterCamera(const LLSD& val)
 // virtual
 BOOL LLFloaterCamera::postBuild()
 {
-	setIsChrome(TRUE);
-	setTitleVisible(TRUE); // restore title visibility after chrome applying
 	updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
 
 	mRotate = getChild<LLJoystickCameraRotate>(ORBIT);
diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp
index 4181d1906e5..58c76a0b85e 100644
--- a/indra/newview/llfloaterhud.cpp
+++ b/indra/newview/llfloaterhud.cpp
@@ -54,14 +54,6 @@ LLFloaterHUD::LLFloaterHUD(const LLSD& key)
 		return;
 	}
 	
-	// Don't grab the focus as it will impede performing in-world actions
-	// while using the HUD
-	setIsChrome(TRUE);
-
-	// Chrome doesn't show the window title by default, but here we
-	// want to show it.
-	setTitleVisible(true);
-	
 	// Opaque background since we never get the focus
 	setBackgroundOpaque(TRUE);
 }
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index 87135130542..a65e9e911a9 100644
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -105,9 +105,6 @@ BOOL LLFloaterMap::postBuild()
 	// Get the drag handle all the way in back
 	sendChildToBack(getDragHandle());
 
-	//setIsChrome(TRUE);
-	//getDragHandle()->setTitleVisible(TRUE);
-	
 	// keep onscreen
 	gFloaterView->adjustToFitScreen(this, FALSE);
 
diff --git a/indra/newview/llfloatersounddevices.cpp b/indra/newview/llfloatersounddevices.cpp
index 56c08065467..72c077d2156 100644
--- a/indra/newview/llfloatersounddevices.cpp
+++ b/indra/newview/llfloatersounddevices.cpp
@@ -55,9 +55,6 @@ BOOL LLFloaterSoundDevices::postBuild()
 {
 	LLTransientDockableFloater::postBuild();
 
-	setIsChrome(TRUE);
-	if (mDragHandle)
-		mDragHandle->setTitleVisible(TRUE);
 	updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730)
 
 	LLPanelVoiceDeviceSettings* panel = findChild<LLPanelVoiceDeviceSettings>("device_settings_panel");
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 6873cf058ae..de305bf3d9d 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -91,8 +91,6 @@ mCloseNotificationOnDestroy(true)
 		sFont = LLFontGL::getFontSansSerif();
 		sFontSmall = LLFontGL::getFontSansSerifSmall();
 	}
-	// clicking on a button does not steal current focus
-	setIsChrome(TRUE);
 	// initialize
 	setFocusRoot(!mIsTip);
 	// get a form for the notification
diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml
index afe8584a2d3..6f6ddd95faa 100644
--- a/indra/newview/skins/default/xui/en/floater_camera.xml
+++ b/indra/newview/skins/default/xui/en/floater_camera.xml
@@ -14,6 +14,7 @@
  save_visibility="true"
  single_instance="true"
  title="VIEW"
+ chrome="true"
  save_rect="true"
  width="228">
     <floater.string
diff --git a/indra/newview/skins/default/xui/en/floater_hud.xml b/indra/newview/skins/default/xui/en/floater_hud.xml
index 99a6a95828e..e2d860881a2 100644
--- a/indra/newview/skins/default/xui/en/floater_hud.xml
+++ b/indra/newview/skins/default/xui/en/floater_hud.xml
@@ -8,6 +8,7 @@
  help_topic="floater_hud"
  save_rect="true"
  save_visibility="true"
+ chrome="true"
  title="TUTORIAL"
  width="362">
     <web_browser
diff --git a/indra/newview/skins/default/xui/en/floater_map.xml b/indra/newview/skins/default/xui/en/floater_map.xml
index 58d67c82211..31972d41224 100644
--- a/indra/newview/skins/default/xui/en/floater_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_map.xml
@@ -3,6 +3,7 @@
  open_positioning="cascading"
  can_minimize="true" 
  can_resize="true"
+ chrome="true"
  follows="top|right"
  height="200"
  layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/floater_moveview.xml b/indra/newview/skins/default/xui/en/floater_moveview.xml
index b7370580af4..b9881e43473 100644
--- a/indra/newview/skins/default/xui/en/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/en/floater_moveview.xml
@@ -15,6 +15,7 @@
  save_rect="true"
  save_visibility="true"
  save_dock_state="true"
+ chrome="true"
  title="MOVE"
  width="133">
     <string
diff --git a/indra/newview/skins/default/xui/en/floater_sound_devices.xml b/indra/newview/skins/default/xui/en/floater_sound_devices.xml
index 3dbe4adf28a..dec0e9b6c62 100644
--- a/indra/newview/skins/default/xui/en/floater_sound_devices.xml
+++ b/indra/newview/skins/default/xui/en/floater_sound_devices.xml
@@ -6,6 +6,7 @@
  can_minimize="true"
  can_resize="false"
  can_close="false"
+ chrome="true"
  save_dock_state="true"
  save_visibility="true"
  save_rect="true"
diff --git a/indra/newview/skins/default/xui/en/floater_voice_controls.xml b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
index 3f5768bc0b5..1a2b248b16c 100644
--- a/indra/newview/skins/default/xui/en/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/en/floater_voice_controls.xml
@@ -4,6 +4,7 @@
  can_resize="true"
  can_minimize="true"
  can_close="true"
+ chrome="true"
  height="205"
  layout="topleft"
  min_height="124"
diff --git a/indra/newview/skins/default/xui/en/panel_notification.xml b/indra/newview/skins/default/xui/en/panel_notification.xml
index 59ead84127a..f6f62ac54eb 100644
--- a/indra/newview/skins/default/xui/en/panel_notification.xml
+++ b/indra/newview/skins/default/xui/en/panel_notification.xml
@@ -9,6 +9,8 @@
   layout="topleft"
   left="0"
   name="notification_panel"
+  chrome="true"
+  show_title="false"
   top="0"
   	height="140"
   translate="false"
-- 
GitLab