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
No related branches found
No related tags found
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() )
{ {
...@@ -284,32 +292,36 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) ...@@ -284,32 +292,36 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask)
if (hasMouseCapture()) if (hasMouseCapture())
{ {
if (mValidClickPoint) // Do not move camera if we haven't gotten a pick
{ if (!mClickPickPending)
if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() ) {
{ if (mValidClickPoint)
LLCoordGL mouse_pos; {
LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgentCamera.getFocusGlobal()); if (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode())
BOOL success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos); {
if (success) LLCoordGL mouse_pos;
{ LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgentCamera.getFocusGlobal());
LLUI::getInstance()->setMousePositionScreen(mouse_pos.mX, mouse_pos.mY); BOOL success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos);
} if (success)
} {
else if (mMouseSteering) LLUI::getInstance()->setMousePositionScreen(mouse_pos.mX, mouse_pos.mY);
{ }
LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY); }
} else if (mMouseSteering)
else {
{ LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY);
gViewerWindow->moveCursorToCenter(); }
} else
} {
else gViewerWindow->moveCursorToCenter();
{ }
// not a valid zoomable object }
LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY); else
} {
// not a valid zoomable object
LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY);
}
}
// calls releaseMouse() internally // calls releaseMouse() internally
setMouseCapture(FALSE); setMouseCapture(FALSE);
......
...@@ -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.
Finish editing this message first!
Please register or to comment