summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMnikolenko ProductEngine <mnikolenko@productengine.com>2016-03-21 17:58:39 +0200
committerMnikolenko ProductEngine <mnikolenko@productengine.com>2016-03-21 17:58:39 +0200
commitca1d7da5718a4ad40856fe404ce89690da984f15 (patch)
tree9a10615235fc0dab6be3cddbbc72c19eb324f976
parent18cd32443a552e4f115d1b2913f262b385766cdf (diff)
MAINT-3171 Alt-clicking while moving mouse can move the camera significantly
-rw-r--r--indra/llwindow/llopenglview-objc.mm2
-rwxr-xr-xindra/llwindow/llwindowcallbacks.cpp4
-rwxr-xr-xindra/llwindow/llwindowcallbacks.h1
-rwxr-xr-xindra/llwindow/llwindowmacosx-objc.h1
-rwxr-xr-xindra/llwindow/llwindowmacosx.cpp12
-rwxr-xr-xindra/newview/llviewerwindow.cpp35
-rwxr-xr-xindra/newview/llviewerwindow.h3
7 files changed, 55 insertions, 3 deletions
diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm
index f3b8dac844..ca502e0659 100644
--- a/indra/llwindow/llopenglview-objc.mm
+++ b/indra/llwindow/llopenglview-objc.mm
@@ -391,7 +391,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
NSPoint mPoint = [theEvent locationInWindow];
mMousePos[0] = mPoint.x;
mMousePos[1] = mPoint.y;
- callMouseMoved(mMousePos, 0);
+ callMouseDragged(mMousePos, 0);
}
- (void) otherMouseDown:(NSEvent *)theEvent
diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp
index eadff8a6b4..d2afb3f91b 100755
--- a/indra/llwindow/llwindowcallbacks.cpp
+++ b/indra/llwindow/llwindowcallbacks.cpp
@@ -112,6 +112,10 @@ void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, M
{
}
+void LLWindowCallbacks::handleMouseDragged(LLWindow *window, const LLCoordGL pos, MASK mask)
+{
+}
+
void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks)
{
}
diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h
index 7da5959700..6a7137e593 100755
--- a/indra/llwindow/llwindowcallbacks.h
+++ b/indra/llwindow/llwindowcallbacks.h
@@ -52,6 +52,7 @@ public:
virtual BOOL handleActivate(LLWindow *window, BOOL activated);
virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
+ virtual void handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask);
virtual void handleScrollWheel(LLWindow *window, S32 clicks);
virtual void handleResize(LLWindow *window, S32 width, S32 height);
virtual void handleFocus(LLWindow *window);
diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h
index dc184b91fb..ce74fc83cc 100755
--- a/indra/llwindow/llwindowmacosx-objc.h
+++ b/indra/llwindow/llwindowmacosx-objc.h
@@ -133,6 +133,7 @@ void callLeftMouseUp(float *pos, unsigned int mask);
void callDoubleClick(float *pos, unsigned int mask);
void callResize(unsigned int width, unsigned int height);
void callMouseMoved(float *pos, unsigned int mask);
+void callMouseDragged(float *pos, unsigned int mask);
void callScrollMoved(float delta);
void callMouseExit();
void callWindowFocus();
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 0d41884462..8cbf5a31fb 100755
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -343,6 +343,18 @@ void callMouseMoved(float *pos, MASK mask)
//gWindowImplementation->getCallbacks()->handleScrollWheel(gWindowImplementation, 0);
}
+void callMouseDragged(float *pos, MASK mask)
+{
+ LLCoordGL outCoords;
+ outCoords.mX = ll_round(pos[0]);
+ outCoords.mY = ll_round(pos[1]);
+ float deltas[2];
+ gWindowImplementation->getMouseDeltas(deltas);
+ outCoords.mX += deltas[0];
+ outCoords.mY += deltas[1];
+ gWindowImplementation->getCallbacks()->handleMouseDragged(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE));
+}
+
void callScrollMoved(float delta)
{
gWindowImplementation->getCallbacks()->handleScrollWheel(gWindowImplementation, delta);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index d3416ec5fc..50329d8576 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1037,7 +1037,16 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK
BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
{
- BOOL down = TRUE;
+ mAllowMouseDragging = FALSE;
+ if (!mMouseDownTimer.getStarted())
+ {
+ mMouseDownTimer.start();
+ }
+ else
+ {
+ mMouseDownTimer.reset();
+ }
+ BOOL down = TRUE;
return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down);
}
@@ -1056,7 +1065,11 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma
BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
- BOOL down = FALSE;
+ if (mMouseDownTimer.getStarted())
+ {
+ mMouseDownTimer.stop();
+ }
+ BOOL down = FALSE;
return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down);
}
@@ -1288,6 +1301,22 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask
}
}
+void LLViewerWindow::handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask)
+{
+ if (mMouseDownTimer.getStarted())
+ {
+ if (mMouseDownTimer.getElapsedTimeF32() > 0.1)
+ {
+ mAllowMouseDragging = TRUE;
+ mMouseDownTimer.stop();
+ }
+ }
+ if(mAllowMouseDragging || !LLToolCamera::getInstance()->hasMouseCapture())
+ {
+ handleMouseMove(window, pos, mask);
+ }
+}
+
void LLViewerWindow::handleMouseLeave(LLWindow *window)
{
// Note: we won't get this if we have captured the mouse.
@@ -1617,6 +1646,8 @@ LLViewerWindow::LLViewerWindow(const Params& p)
mMiddleMouseDown(FALSE),
mRightMouseDown(FALSE),
mMouseInWindow( FALSE ),
+ mAllowMouseDragging(TRUE),
+ mMouseDownTimer(),
mLastMask( MASK_NONE ),
mToolStored( NULL ),
mHideCursorPermanent( FALSE ),
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index d34e76f6f6..ad06f00234 100755
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -193,6 +193,7 @@ public:
/*virtual*/ BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
/*virtual*/ LLWindowCallbacks::DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data);
void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
+ void handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask);
/*virtual*/ void handleMouseLeave(LLWindow *window);
/*virtual*/ void handleResize(LLWindow *window, S32 x, S32 y);
/*virtual*/ void handleFocus(LLWindow *window);
@@ -463,6 +464,8 @@ private:
BOOL mMouseInWindow; // True if the mouse is over our window or if we have captured the mouse.
BOOL mFocusCycleMode;
+ BOOL mAllowMouseDragging;
+ LLFrameTimer mMouseDownTimer;
typedef std::set<LLHandle<LLView> > view_handle_set_t;
view_handle_set_t mMouseHoverViews;