From 0526d673093b2279777dc8be5aae9cc33cb1c822 Mon Sep 17 00:00:00 2001
From: Richard Nelson <richard@lindenlab.com>
Date: Mon, 10 Oct 2011 15:31:25 -0700
Subject: [PATCH] EXP-1312 FIX Floaters should appear in region not covered by
 toolbars moved floater snap region to middle of toolbars and constrained
 floaters to that snap region also made toybox floater pass all drag and drop
 events along to toolbar

---
 indra/llui/llfloater.cpp                              |  2 +-
 indra/newview/llfloatertoybox.cpp                     | 11 +++++++++++
 indra/newview/llfloatertoybox.h                       |  5 +++++
 indra/newview/skins/default/xui/en/main_view.xml      |  7 -------
 .../skins/default/xui/en/panel_toolbar_view.xml       |  7 +++++++
 5 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index cc49238a0b4..cba14e21c30 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2549,7 +2549,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
 	}
 
 	// move window fully onscreen
-	if (floater->translateIntoRect( getLocalRect(), allow_partial_outside ))
+	if (floater->translateIntoRect( getSnapRect(), allow_partial_outside ))
 	{
 		floater->clearSnapTarget();
 	}
diff --git a/indra/newview/llfloatertoybox.cpp b/indra/newview/llfloatertoybox.cpp
index 609041803a4..fa600229110 100644
--- a/indra/newview/llfloatertoybox.cpp
+++ b/indra/newview/llfloatertoybox.cpp
@@ -120,5 +120,16 @@ void LLFloaterToybox::onBtnRestoreDefaults()
 	LLToolBarView::loadDefaultToolbars();
 }
 
+BOOL LLFloaterToybox::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+	EDragAndDropType cargo_type,
+	void* cargo_data,
+	EAcceptance* accept,
+	std::string& tooltip_msg)
+{
+	S32 local_x = x - mToolBar->getRect().mLeft;
+	S32 local_y = y - mToolBar->getRect().mBottom;
+	return mToolBar->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+}
+
 
 // eof
diff --git a/indra/newview/llfloatertoybox.h b/indra/newview/llfloatertoybox.h
index f7245506c59..f0a6cf1a8be 100644
--- a/indra/newview/llfloatertoybox.h
+++ b/indra/newview/llfloatertoybox.h
@@ -43,6 +43,11 @@ class LLFloaterToybox : public LLFloater
 	// virtuals
 	BOOL postBuild();
 	void draw();
+	/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
+		EDragAndDropType cargo_type,
+		void* cargo_data,
+		EAcceptance* accept,
+		std::string& tooltip_msg);
 
 protected:
 	void onBtnRestoreDefaults();
diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml
index 57baa7cdd39..96d070ae509 100644
--- a/indra/newview/skins/default/xui/en/main_view.xml
+++ b/indra/newview/skins/default/xui/en/main_view.xml
@@ -74,13 +74,6 @@
                           user_resize="false" 
                           name="hud container"
                           width="500">
-              <view top="0"
-                    follows="all"
-                    height="500"
-                    left="0"
-                    mouse_opaque="false"
-                    name="floater_snap_region"
-                    width="500"/>
               <panel follows="left|top"
                      height="19"
                      left="0"
diff --git a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
index 03d45887d42..bc96bfbab58 100644
--- a/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
+++ b/indra/newview/skins/default/xui/en/panel_toolbar_view.xml
@@ -55,6 +55,13 @@
                     mouse_opaque="false"
                     height="100"
                     width="100">
+        <view top="0"
+              follows="all"
+              height="100"
+              left="0"
+              mouse_opaque="false"
+              name="floater_snap_region"
+              width="100"/>
         <panel bottom="100"
                follows="left|right|bottom"
                height="25"
-- 
GitLab