From 1e2d424f9e82a1d75a4b78b06910400f55c5169a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 5 Dec 2011 23:35:29 +0100 Subject: STORM-1713: Mouse pointer flickers when hovering over any active/clickable UI item --- indra/llwindow/llwindow.cpp | 1 + indra/llwindow/llwindow.h | 4 +++- indra/llwindow/llwindowheadless.h | 2 +- indra/llwindow/llwindowmacosx.cpp | 26 ++++++++++++++------------ indra/llwindow/llwindowmacosx.h | 2 +- indra/llwindow/llwindowmesaheadless.h | 2 +- indra/llwindow/llwindowsdl.cpp | 14 ++++++++------ indra/llwindow/llwindowsdl.h | 2 +- indra/llwindow/llwindowwin32.cpp | 14 ++++++++------ indra/llwindow/llwindowwin32.h | 2 +- 10 files changed, 39 insertions(+), 30 deletions(-) (limited to 'indra') diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index dc3a1099b1..9d0d73b81e 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -108,6 +108,7 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) mSupportedResolutions(NULL), mNumSupportedResolutions(0), mCurrentCursor(UI_CURSOR_ARROW), + mNextCursor(UI_CURSOR_ARROW), mCursorHidden(FALSE), mBusyCount(0), mIsMouseClipping(FALSE), diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index e8a86a1880..e5fcd19f2c 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -91,8 +91,9 @@ public: virtual S32 getBusyCount() const; // Sets cursor, may set to arrow+hourglass - virtual void setCursor(ECursorType cursor) = 0; + virtual void setCursor(ECursorType cursor) { mNextCursor = cursor; }; virtual ECursorType getCursor() const; + virtual void updateCursor() = 0; virtual void captureMouse() = 0; virtual void releaseMouse() = 0; @@ -181,6 +182,7 @@ protected: LLWindowResolution* mSupportedResolutions; S32 mNumSupportedResolutions; ECursorType mCurrentCursor; + ECursorType mNextCursor; BOOL mCursorHidden; S32 mBusyCount; // how deep is the "cursor busy" stack? BOOL mIsMouseClipping; // Is this window currently clipping the mouse diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index ac53e6a86e..1e911d7547 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -55,7 +55,7 @@ public: /*virtual*/ void showCursorFromMouseMove() {}; /*virtual*/ void hideCursorUntilMouseMove() {}; /*virtual*/ BOOL isCursorHidden() {return FALSE;}; - /*virtual*/ void setCursor(ECursorType cursor) {}; + /*virtual*/ void updateCursor() {}; //virtual ECursorType getCursor() { return mCurrentCursor; }; /*virtual*/ void captureMouse() {}; /*virtual*/ void releaseMouse() {}; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index d116f0dfff..d4832602a0 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1164,6 +1164,8 @@ void LLWindowMacOSX::gatherInput() } } + + updateCursor(); } BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) @@ -2841,7 +2843,7 @@ static void initPixmapCursor(int cursorid, int hotspotX, int hotspotY) gCursors[cursorid] = createImageCursor(fullpath.c_str(), hotspotX, hotspotY); } -void LLWindowMacOSX::setCursor(ECursorType cursor) +void LLWindowMacOSX::updateCursor() { OSStatus result = noErr; @@ -2849,30 +2851,30 @@ void LLWindowMacOSX::setCursor(ECursorType cursor) { // A drag is in progress...remember the requested cursor and we'll // restore it when it is done - mCurrentCursor = cursor; + mCurrentCursor = mNextCursor; return; } - if (cursor == UI_CURSOR_ARROW + if (mNextCursor == UI_CURSOR_ARROW && mBusyCount > 0) { - cursor = UI_CURSOR_WORKING; + mNextCursor = UI_CURSOR_WORKING; } - if(mCurrentCursor == cursor) + if(mCurrentCursor == mNextCursor) return; // RN: replace multi-drag cursors with single versions - if (cursor == UI_CURSOR_ARROWDRAGMULTI) + if (mNextCursor == UI_CURSOR_ARROWDRAGMULTI) { - cursor = UI_CURSOR_ARROWDRAG; + mNextCursor = UI_CURSOR_ARROWDRAG; } - else if (cursor == UI_CURSOR_ARROWCOPYMULTI) + else if (mNextCursor == UI_CURSOR_ARROWCOPYMULTI) { - cursor = UI_CURSOR_ARROWCOPY; + mNextCursor = UI_CURSOR_ARROWCOPY; } - switch(cursor) + switch(mNextCursor) { default: case UI_CURSOR_ARROW: @@ -2923,7 +2925,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor) case UI_CURSOR_TOOLSIT: case UI_CURSOR_TOOLBUY: case UI_CURSOR_TOOLOPEN: - result = setImageCursor(gCursors[cursor]); + result = setImageCursor(gCursors[mNextCursor]); break; } @@ -2933,7 +2935,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor) InitCursor(); } - mCurrentCursor = cursor; + mCurrentCursor = mNextCursor; } ECursorType LLWindowMacOSX::getCursor() const diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 6c9e075a21..1414a7e2a7 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -67,7 +67,7 @@ public: /*virtual*/ void showCursorFromMouseMove(); /*virtual*/ void hideCursorUntilMouseMove(); /*virtual*/ BOOL isCursorHidden(); - /*virtual*/ void setCursor(ECursorType cursor); + /*virtual*/ void updateCursor(); /*virtual*/ ECursorType getCursor() const; /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index fd4bd635e2..db7cb43754 100644 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -59,7 +59,7 @@ public: /*virtual*/ void showCursorFromMouseMove() {}; /*virtual*/ void hideCursorUntilMouseMove() {}; /*virtual*/ BOOL isCursorHidden() {return FALSE;}; - /*virtual*/ void setCursor(ECursorType cursor) {}; + /*virtual*/ void updateCursor() {}; //virtual ECursorType getCursor() { return mCurrentCursor; }; /*virtual*/ void captureMouse() {}; /*virtual*/ void releaseMouse() {}; diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 8acb52516a..f8c6697432 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1920,6 +1920,8 @@ void LLWindowSDL::gatherInput() break; } } + + updateCursor(); #if LL_X11 // This is a good time to stop flashing the icon if our mFlashTimer has @@ -2006,7 +2008,7 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty return sdlcursor; } -void LLWindowSDL::setCursor(ECursorType cursor) +void LLWindowSDL::updateCursor() { if (ATIbug) { // cursor-updating is very flaky when this bug is @@ -2014,11 +2016,11 @@ void LLWindowSDL::setCursor(ECursorType cursor) return; } - if (mCurrentCursor != cursor) + if (mCurrentCursor != mNextCursor) { - if (cursor < UI_CURSOR_COUNT) + if (mNextCursor < UI_CURSOR_COUNT) { - SDL_Cursor *sdlcursor = mSDLCursors[cursor]; + SDL_Cursor *sdlcursor = mSDLCursors[mNextCursor]; // Try to default to the arrow for any cursors that // did not load correctly. if (!sdlcursor && mSDLCursors[UI_CURSOR_ARROW]) @@ -2026,9 +2028,9 @@ void LLWindowSDL::setCursor(ECursorType cursor) if (sdlcursor) SDL_SetCursor(sdlcursor); } else { - llwarns << "Tried to set invalid cursor number " << cursor << llendl; + llwarns << "Tried to set invalid cursor number " << mNextCursor << llendl; } - mCurrentCursor = cursor; + mCurrentCursor = mNextCursor; } } diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index fa544b16ce..fb3b117693 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -72,7 +72,7 @@ public: /*virtual*/ void showCursorFromMouseMove(); /*virtual*/ void hideCursorUntilMouseMove(); /*virtual*/ BOOL isCursorHidden(); - /*virtual*/ void setCursor(ECursorType cursor); + /*virtual*/ void updateCursor(); /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); /*virtual*/ void setMouseClipping( BOOL b ); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 799f0a3fab..03fff3d526 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1667,18 +1667,18 @@ void LLWindowWin32::initCursors() -void LLWindowWin32::setCursor(ECursorType cursor) +void LLWindowWin32::updateCursor() { - if (cursor == UI_CURSOR_ARROW + if (mNextCursor == UI_CURSOR_ARROW && mBusyCount > 0) { - cursor = UI_CURSOR_WORKING; + mNextCursor = UI_CURSOR_WORKING; } - if( mCurrentCursor != cursor ) + if( mCurrentCursor != mNextCursor ) { - mCurrentCursor = cursor; - SetCursor( mCursor[cursor] ); + mCurrentCursor = mNextCursor; + SetCursor( mCursor[mNextCursor] ); } } @@ -1760,6 +1760,8 @@ void LLWindowWin32::gatherInput() mInputProcessingPaused = FALSE; + updateCursor(); + // clear this once we've processed all mouse messages that might have occurred after // we slammed the mouse position mMousePositionModified = FALSE; diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 387e4cbdb6..84f731a79f 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -66,7 +66,7 @@ public: /*virtual*/ void showCursorFromMouseMove(); /*virtual*/ void hideCursorUntilMouseMove(); /*virtual*/ BOOL isCursorHidden(); - /*virtual*/ void setCursor(ECursorType cursor); + /*virtual*/ void updateCursor(); /*virtual*/ ECursorType getCursor() const; /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); -- cgit v1.2.3