summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorakleshchev <117672381+akleshchev@users.noreply.github.com>2022-12-11 19:08:48 +0200
committerGitHub <noreply@github.com>2022-12-11 19:08:48 +0200
commit5bfe93b4ea6ed1d402fca3e40fba9ede8b45864f (patch)
treea2beaf3330b8a303ea96bad4ee25cc067626dbec /indra/newview
parentf01f39afd1b43a43a9886d3146fd4ea0950459b0 (diff)
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.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llagentcamera.h1
-rw-r--r--indra/newview/lltoolfocus.cpp78
-rw-r--r--indra/newview/lltoolfocus.h1
3 files changed, 46 insertions, 34 deletions
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 89680f95dc..4d005ef024 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -167,7 +167,6 @@ private:
// Follow
//--------------------------------------------------------------------
public:
- void setUsingFollowCam(bool using_follow_cam);
bool isfollowCamLocked();
private:
LLFollowCam mFollowCam; // Ventrella
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index 07f46c5fbe..4e94895a3e 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -75,6 +75,7 @@ LLToolCamera::LLToolCamera()
mOutsideSlopX(FALSE),
mOutsideSlopY(FALSE),
mValidClickPoint(FALSE),
+ mClickPickPending(false),
mValidSelection(FALSE),
mMouseSteering(FALSE),
mMouseUpX(0),
@@ -127,6 +128,11 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask)
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
// at the point we moused down. JC
mMouseUpX = x;
@@ -142,13 +148,15 @@ BOOL LLToolCamera::handleMouseDown(S32 x, S32 y, MASK mask)
void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
{
- if (!LLToolCamera::getInstance()->hasMouseCapture())
+ LLToolCamera* camera = LLToolCamera::getInstance();
+ if (!camera->mClickPickPending)
{
return;
}
+ camera->mClickPickPending = false;
- LLToolCamera::getInstance()->mMouseDownX = pick_info.mMousePt.mX;
- LLToolCamera::getInstance()->mMouseDownY = pick_info.mMousePt.mY;
+ camera->mMouseDownX = pick_info.mMousePt.mX;
+ camera->mMouseDownY = pick_info.mMousePt.mY;
gViewerWindow->moveCursorToCenter();
@@ -158,7 +166,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
// Check for hit the sky, or some other invalid point
if (!hit_obj && pick_info.mPosGlobal.isExactlyZero())
{
- LLToolCamera::getInstance()->mValidClickPoint = FALSE;
+ camera->mValidClickPoint = FALSE;
return;
}
@@ -168,7 +176,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD)
{
- LLToolCamera::getInstance()->mValidClickPoint = FALSE;
+ camera->mValidClickPoint = FALSE;
return;
}
}
@@ -192,7 +200,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
if( !good_customize_avatar_hit )
{
- LLToolCamera::getInstance()->mValidClickPoint = FALSE;
+ camera->mValidClickPoint = FALSE;
return;
}
@@ -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() )
{
@@ -284,32 +292,36 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask)
if (hasMouseCapture())
{
- if (mValidClickPoint)
- {
- if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() )
- {
- LLCoordGL mouse_pos;
- LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgentCamera.getFocusGlobal());
- BOOL success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos);
- if (success)
- {
- LLUI::getInstance()->setMousePositionScreen(mouse_pos.mX, mouse_pos.mY);
- }
- }
- else if (mMouseSteering)
- {
- LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY);
- }
- else
- {
- gViewerWindow->moveCursorToCenter();
- }
- }
- else
- {
- // not a valid zoomable object
- LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY);
- }
+ // Do not move camera if we haven't gotten a pick
+ if (!mClickPickPending)
+ {
+ if (mValidClickPoint)
+ {
+ if (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode())
+ {
+ LLCoordGL mouse_pos;
+ LLVector3 focus_pos = gAgent.getPosAgentFromGlobal(gAgentCamera.getFocusGlobal());
+ BOOL success = LLViewerCamera::getInstance()->projectPosAgentToScreen(focus_pos, mouse_pos);
+ if (success)
+ {
+ LLUI::getInstance()->setMousePositionScreen(mouse_pos.mX, mouse_pos.mY);
+ }
+ }
+ else if (mMouseSteering)
+ {
+ LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY);
+ }
+ else
+ {
+ gViewerWindow->moveCursorToCenter();
+ }
+ }
+ else
+ {
+ // not a valid zoomable object
+ LLUI::getInstance()->setMousePositionScreen(mMouseDownX, mMouseDownY);
+ }
+ }
// calls releaseMouse() internally
setMouseCapture(FALSE);
diff --git a/indra/newview/lltoolfocus.h b/indra/newview/lltoolfocus.h
index cfc235b6c2..6615193318 100644
--- a/indra/newview/lltoolfocus.h
+++ b/indra/newview/lltoolfocus.h
@@ -65,6 +65,7 @@ protected:
BOOL mOutsideSlopX;
BOOL mOutsideSlopY;
BOOL mValidClickPoint;
+ bool mClickPickPending;
BOOL mValidSelection;
BOOL mMouseSteering;
S32 mMouseUpX; // needed for releaseMouse()