From 84c546182c67b2d9f6542f95d979ed33903cb95f Mon Sep 17 00:00:00 2001
From: AndreyL ProductEngine <alihatskiy@productengine.com>
Date: Mon, 5 Dec 2016 19:21:11 +0200
Subject: Backed out changeset: ffffbe002ff2 Finally reverting the MAINT-4488
 (see BUG-37693 for details)

---
 indra/newview/llagent.cpp    | 18 ++----------------
 indra/newview/llagent.h      |  8 +++-----
 indra/newview/lltool.cpp     | 21 +++------------------
 indra/newview/lltoolcomp.cpp | 26 ++++++++++++--------------
 indra/newview/lltoolgrab.cpp |  2 +-
 5 files changed, 21 insertions(+), 54 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index d8b0787852..6a1215c3af 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3191,7 +3191,7 @@ void LLAgent::initOriginGlobal(const LLVector3d &origin_global)
 }
 
 BOOL LLAgent::leftButtonGrabbed() const	
-{
+{ 
 	const BOOL camera_mouse_look = gAgentCamera.cameraMouselook();
 	return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0) 
 		|| (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0)
@@ -3199,13 +3199,6 @@ BOOL LLAgent::leftButtonGrabbed() const
 		|| (camera_mouse_look && mControlsTakenPassedOnCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0);
 }
 
-BOOL LLAgent::leftButtonBlocked() const
-{
-    const BOOL camera_mouse_look = gAgentCamera.cameraMouselook();
-    return (!camera_mouse_look && mControlsTakenCount[CONTROL_LBUTTON_DOWN_INDEX] > 0)
-        || (camera_mouse_look && mControlsTakenCount[CONTROL_ML_LBUTTON_DOWN_INDEX] > 0);
-}
-
 BOOL LLAgent::rotateGrabbed() const		
 { 
 	return (mControlsTakenCount[CONTROL_YAW_POS_INDEX] > 0)
@@ -3663,14 +3656,7 @@ BOOL LLAgent::anyControlGrabbed() const
 
 BOOL LLAgent::isControlGrabbed(S32 control_index) const
 {
-    if (gAgent.mControlsTakenCount[control_index] > 0)
-        return TRUE;
-    return gAgent.mControlsTakenPassedOnCount[control_index] > 0;
-}
-
-BOOL LLAgent::isControlBlocked(S32 control_index) const
-{
-    return mControlsTakenCount[control_index] > 0;
+	return mControlsTakenCount[control_index] > 0;
 }
 
 void LLAgent::forceReleaseControls()
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index d82ff7a67f..b5da5e9062 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -444,8 +444,7 @@ private:
 	// Grab
 	//--------------------------------------------------------------------
 public:
-    BOOL 			leftButtonGrabbed() const;
-    BOOL 			leftButtonBlocked() const;
+	BOOL 			leftButtonGrabbed() const;
 	BOOL 			rotateGrabbed() const;
 	BOOL 			forwardGrabbed() const;
 	BOOL 			backwardGrabbed() const;
@@ -462,9 +461,8 @@ public:
 	BOOL			controlFlagsDirty() const;
 	void			enableControlFlagReset();
 	void 			resetControlFlags();
-	BOOL			anyControlGrabbed() const; 		// True if a script has taken over any control
-    BOOL			isControlGrabbed(S32 control_index) const; // True if a script has taken over a control
-    BOOL			isControlBlocked(S32 control_index) const; // Control should be ignored or won't be passed
+	BOOL			anyControlGrabbed() const; 		// True iff a script has taken over a control
+	BOOL			isControlGrabbed(S32 control_index) const;
 	// Send message to simulator to force grabbed controls to be
 	// released, in case of a poorly written script.
 	void			forceReleaseControls();
diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp
index 5e703933ca..4aad650b68 100644
--- a/indra/newview/lltool.cpp
+++ b/indra/newview/lltool.cpp
@@ -38,7 +38,6 @@
 #include "lltoolfocus.h"
 #include "llfocusmgr.h"
 #include "llagent.h"
-#include "llagentcamera.h"
 #include "llviewerjoystick.h"
 
 extern BOOL gDebugClicks;
@@ -85,14 +84,7 @@ BOOL LLTool::handleMouseDown(S32 x, S32 y, MASK mask)
 	}
 	// by default, didn't handle it
 	// LL_INFOS() << "LLTool::handleMouseDown" << LL_ENDL;
-    if (gAgentCamera.cameraMouselook())
-    {
-        gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
-    }
-    else
-    {
-        gAgent.setControlFlags(AGENT_CONTROL_LBUTTON_DOWN);
-    }
+	gAgent.setControlFlags(AGENT_CONTROL_LBUTTON_DOWN);
 	return TRUE;
 }
 
@@ -103,15 +95,8 @@ BOOL LLTool::handleMouseUp(S32 x, S32 y, MASK mask)
 		LL_INFOS() << "LLTool left mouse up" << LL_ENDL;
 	}
 	// by default, didn't handle it
-    // LL_INFOS() << "LLTool::handleMouseUp" << LL_ENDL;
-    if (gAgentCamera.cameraMouselook())
-    {
-        gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_UP);
-    }
-    else
-    {
-        gAgent.setControlFlags(AGENT_CONTROL_LBUTTON_UP);
-    }
+	// LL_INFOS() << "LLTool::handleMouseUp" << LL_ENDL;
+	gAgent.setControlFlags(AGENT_CONTROL_LBUTTON_UP);
 	return TRUE;
 }
 
diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp
index d9adec82b4..392c103d7c 100644
--- a/indra/newview/lltoolcomp.cpp
+++ b/indra/newview/lltoolcomp.cpp
@@ -742,13 +742,12 @@ BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask)
 
 BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask)
 { 
-    // if the left button is blocked, don't put up the pie menu
-    if (gAgent.leftButtonBlocked())
-    {
-        // in case of "grabbed" control flag will be set later
-        gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
-        return FALSE;
-    }
+	// if the left button is grabbed, don't put up the pie menu
+	if (gAgent.leftButtonGrabbed())
+	{
+		gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
+		return FALSE;
+	}
 
 	// On mousedown, start grabbing
 	gGrabTransientTool = this;
@@ -760,13 +759,12 @@ BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask)
 
 BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask)
 {
-    // if the left button is blocked, don't put up the pie menu
-    if (gAgent.leftButtonBlocked())
-    {
-        // in case of "grabbed" control flag will be set later
-        gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
-        return FALSE;
-    }
+	// if the left button is grabbed, don't put up the pie menu
+	if (gAgent.leftButtonGrabbed())
+	{
+		gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN);
+		return FALSE;
+	}
 
 	// On mousedown, start grabbing
 	gGrabTransientTool = this;
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp
index ed32e584a5..5623036b91 100644
--- a/indra/newview/lltoolgrab.cpp
+++ b/indra/newview/lltoolgrab.cpp
@@ -143,7 +143,7 @@ BOOL LLToolGrabBase::handleMouseDown(S32 x, S32 y, MASK mask)
 	// call the base class to propogate info to sim
 	LLTool::handleMouseDown(x, y, mask);
 	
-	if (!gAgent.leftButtonBlocked())
+	if (!gAgent.leftButtonGrabbed())
 	{
 		// can grab transparent objects (how touch event propagates, scripters rely on this)
 		gViewerWindow->pickAsync(x, y, mask, pickCallback, /*BOOL pick_transparent*/ TRUE);
-- 
cgit v1.2.3