Skip to content
Snippets Groups Projects
Unverified Commit 5bfe93b4 authored by akleshchev's avatar akleshchev Committed by GitHub
Browse files

SL-18159 Windows' mouse from keyboard emulation causes pointer to jump around the screen.

Emulated mouse was trigering "not a valid zoomable object" case and jumping to garbage mMouseDownX/Y due to 'up' event being too early.
parent f01f39af
Branches
Tags
No related merge requests found
...@@ -167,7 +167,6 @@ class LLAgentCamera ...@@ -167,7 +167,6 @@ class LLAgentCamera
// Follow // Follow
//-------------------------------------------------------------------- //--------------------------------------------------------------------
public: public:
void setUsingFollowCam(bool using_follow_cam);
bool isfollowCamLocked(); bool isfollowCamLocked();
private: private:
LLFollowCam mFollowCam; // Ventrella LLFollowCam mFollowCam; // Ventrella
......
...@@ -75,6 +75,7 @@ LLToolCamera::LLToolCamera() ...@@ -75,6 +75,7 @@ LLToolCamera::LLToolCamera()
mOutsideSlopX(FALSE), mOutsideSlopX(FALSE),
mOutsideSlopY(FALSE), mOutsideSlopY(FALSE),
mValidClickPoint(FALSE), mValidClickPoint(FALSE),
mClickPickPending(false),
mValidSelection(FALSE), mValidSelection(FALSE),
mMouseSteering(FALSE), mMouseSteering(FALSE),
mMouseUpX(0), mMouseUpX(0),
...@@ -127,6 +128,11 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask) ...@@ -127,6 +128,11 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask)
mValidClickPoint = FALSE; mValidClickPoint = FALSE;
// Sometimes Windows issues down and up events near simultaneously
// without giving async pick a chance to trigged
// Ex: mouse from numlock emulation
mClickPickPending = true;
// If mouse capture gets ripped away, claim we moused up // If mouse capture gets ripped away, claim we moused up
// at the point we moused down. JC // at the point we moused down. JC
mMouseUpX = x; mMouseUpX = x;
...@@ -142,13 +148,15 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask) ...@@ -142,13 +148,15 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask)
void LLToolCamera::pickCallback(const LLPickInfo& pick_info) void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
{ {
if (!LLToolCamera::getInstance()->hasMouseCapture()) LLToolCamera* camera = LLToolCamera::getInstance();
if (!camera->mClickPickPending)
{ {
return; return;
} }
camera->mClickPickPending = false;
LLToolCamera::getInstance()->mMouseDownX = pick_info.mMousePt.mX; camera->mMouseDownX = pick_info.mMousePt.mX;
LLToolCamera::getInstance()->mMouseDownY = pick_info.mMousePt.mY; camera->mMouseDownY = pick_info.mMousePt.mY;
gViewerWindow->moveCursorToCenter(); gViewerWindow->moveCursorToCenter();
...@@ -158,7 +166,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) ...@@ -158,7 +166,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
// Check for hit the sky, or some other invalid point // Check for hit the sky, or some other invalid point
if (!hit_obj && pick_info.mPosGlobal.isExactlyZero()) if (!hit_obj && pick_info.mPosGlobal.isExactlyZero())
{ {
LLToolCamera::getInstance()->mValidClickPoint = FALSE; camera->mValidClickPoint = FALSE;
return; return;
} }
...@@ -168,7 +176,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) ...@@ -168,7 +176,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD) if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD)
{ {
LLToolCamera::getInstance()->mValidClickPoint = FALSE; camera->mValidClickPoint = FALSE;
return; return;
} }
} }
...@@ -192,7 +200,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) ...@@ -192,7 +200,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
if( !good_customize_avatar_hit ) if( !good_customize_avatar_hit )
{ {
LLToolCamera::getInstance()->mValidClickPoint = FALSE; camera->mValidClickPoint = FALSE;
return; return;
} }
...@@ -237,7 +245,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info) ...@@ -237,7 +245,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
} }
LLToolCamera::getInstance()->mValidClickPoint = TRUE; camera->mValidClickPoint = TRUE;
if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() ) if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() )
{ {
...@@ -283,6 +291,9 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) ...@@ -283,6 +291,9 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask)
mMouseUpMask = mask; mMouseUpMask = mask;
if (hasMouseCapture()) if (hasMouseCapture())
{
// Do not move camera if we haven't gotten a pick
if (!mClickPickPending)
{ {
if (mValidClickPoint) if (mValidClickPoint)
{ {
...@@ -309,6 +320,7 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) ...@@ -309,6 +320,7 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask)
{ {
// not a valid zoomable object // not a valid zoomable object
LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY); LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY);
}
} }
// calls releaseMouse() internally // calls releaseMouse() internally
......
...@@ -65,6 +65,7 @@ class LLToolCamera ...@@ -65,6 +65,7 @@ class LLToolCamera
BOOL mOutsideSlopX; BOOL mOutsideSlopX;
BOOL mOutsideSlopY; BOOL mOutsideSlopY;
BOOL mValidClickPoint; BOOL mValidClickPoint;
bool mClickPickPending;
BOOL mValidSelection; BOOL mValidSelection;
BOOL mMouseSteering; BOOL mMouseSteering;
S32 mMouseUpX; // needed for releaseMouse() S32 mMouseUpX; // needed for releaseMouse()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment