diff options
Diffstat (limited to 'indra/llwindow')
| -rw-r--r-- | indra/llwindow/llwindow.h | 1 | ||||
| -rw-r--r-- | indra/llwindow/llwindowheadless.h | 1 | ||||
| -rw-r--r-- | indra/llwindow/llwindowmacosx.h | 1 | ||||
| -rw-r--r-- | indra/llwindow/llwindowsdl.h | 1 | ||||
| -rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 3 | ||||
| -rw-r--r-- | indra/llwindow/llwindowwin32.h | 2 |
6 files changed, 9 insertions, 0 deletions
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index d0fa16b26a..7a5404e615 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -95,6 +95,7 @@ public: #if LL_WINDOWS virtual bool getCursorDelta(LLCoordCommon* delta) = 0; #endif + virtual bool isWrapMouse() const = 0; virtual void showCursor() = 0; virtual void hideCursor() = 0; virtual bool isCursorHidden() = 0; diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index 5696b69a59..dc7b833013 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -63,6 +63,7 @@ public: #if LL_WINDOWS /*virtual*/ bool getCursorDelta(LLCoordCommon* delta) override { return false; } #endif + /*virtual*/ bool isWrapMouse() const override { return true; } /*virtual*/ void showCursor() override {} /*virtual*/ void hideCursor() override {} /*virtual*/ void showCursorFromMouseMove() override {} diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 110c5756d0..d703a84d02 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -63,6 +63,7 @@ public: bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) override; bool setCursorPosition(LLCoordWindow position) override; bool getCursorPosition(LLCoordWindow *position) override; + bool isWrapMouse() const override { return !mCursorDecoupled; }; void showCursor() override; void hideCursor() override; void showCursorFromMouseMove() override; diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 196ad2986d..521d52df30 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -68,6 +68,7 @@ public: /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp = NULL); /*virtual*/ bool setCursorPosition(LLCoordWindow position); /*virtual*/ bool getCursorPosition(LLCoordWindow *position); + /*virtual*/ bool isWrapMouse() const override { return true; } /*virtual*/ void showCursor(); /*virtual*/ void hideCursor(); /*virtual*/ void showCursorFromMouseMove(); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 23d5866710..824d0f5ec6 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -450,6 +450,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, F32 max_gl_version) : LLWindow(callbacks, fullscreen, flags), + mAbsoluteCursorPosition(false), mMaxGLVersion(max_gl_version), mMaxCores(max_cores) { @@ -3156,6 +3157,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ prev_absolute_x = absolute_x; prev_absolute_y = absolute_y; + window_imp->mAbsoluteCursorPosition = true; } else { @@ -3172,6 +3174,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->mRawMouseDelta.mX += (S32)round((F32)raw->data.mouse.lLastX * (F32)speed / DEFAULT_SPEED); window_imp->mRawMouseDelta.mY -= (S32)round((F32)raw->data.mouse.lLastY * (F32)speed / DEFAULT_SPEED); } + window_imp->mAbsoluteCursorPosition = false; } } } diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 7196706f87..0fc93ad0b1 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -70,6 +70,7 @@ public: /*virtual*/ bool setCursorPosition(LLCoordWindow position); /*virtual*/ bool getCursorPosition(LLCoordWindow *position); /*virtual*/ bool getCursorDelta(LLCoordCommon* delta); + /*virtual*/ bool isWrapMouse() const override { return !mAbsoluteCursorPosition; }; /*virtual*/ void showCursor(); /*virtual*/ void hideCursor(); /*virtual*/ void showCursorFromMouseMove(); @@ -195,6 +196,7 @@ protected: HCURSOR mCursor[ UI_CURSOR_COUNT ]; // Array of all mouse cursors LLCoordWindow mCursorPosition; // mouse cursor position, should only be mutated on main thread + bool mAbsoluteCursorPosition; // true if last position was received in absolute coordinates. LLMutex mRawMouseMutex; RAWINPUTDEVICE mRawMouse; LLCoordWindow mLastCursorPosition; // mouse cursor position from previous frame |
