Fix for STORM-1713: Mouse cursor flickering when hovered over inworld objects

Sun, 18 Dec 2011 13:13:42 +0100

author
Ansariel
date
Sun, 18 Dec 2011 13:13:42 +0100
changeset 1605
9e24dabbfa7c
parent 1604
4c9bc5da3f18
child 1606
3c98a3ae1707

Fix for STORM-1713: Mouse cursor flickering when hovered over inworld objects

indra/llwindow/llwindow.cpp file | annotate | diff | revisions
indra/llwindow/llwindow.h file | annotate | diff | revisions
indra/llwindow/llwindowheadless.h file | annotate | diff | revisions
indra/llwindow/llwindowmacosx.cpp file | annotate | diff | revisions
indra/llwindow/llwindowmacosx.h file | annotate | diff | revisions
indra/llwindow/llwindowmesaheadless.h file | annotate | diff | revisions
indra/llwindow/llwindowsdl.cpp file | annotate | diff | revisions
indra/llwindow/llwindowsdl.h file | annotate | diff | revisions
indra/llwindow/llwindowwin32.cpp file | annotate | diff | revisions
indra/llwindow/llwindowwin32.h file | annotate | diff | revisions
     1.1 --- a/indra/llwindow/llwindow.cpp	Tue Dec 13 23:13:31 2011 +0100
     1.2 +++ b/indra/llwindow/llwindow.cpp	Sun Dec 18 13:13:42 2011 +0100
     1.3 @@ -268,6 +268,7 @@
     1.4  	  mSupportedResolutions(NULL),
     1.5  	  mNumSupportedResolutions(0),
     1.6  	  mCurrentCursor(UI_CURSOR_ARROW),
     1.7 +	  mNextCursor(UI_CURSOR_ARROW),
     1.8  	  mCursorHidden(FALSE),
     1.9  	  mBusyCount(0),
    1.10  	  mIsMouseClipping(FALSE),
     2.1 --- a/indra/llwindow/llwindow.h	Tue Dec 13 23:13:31 2011 +0100
     2.2 +++ b/indra/llwindow/llwindow.h	Sun Dec 18 13:13:42 2011 +0100
     2.3 @@ -139,8 +139,9 @@
     2.4  	virtual S32 getBusyCount() const { return mBusyCount; }
     2.5  
     2.6  	// Sets cursor, may set to arrow+hourglass
     2.7 -	virtual void setCursor(ECursorType cursor) = 0;
     2.8 -	virtual ECursorType getCursor() const { return mCurrentCursor; }
     2.9 +	virtual void setCursor(ECursorType cursor)	{ mNextCursor = cursor; }
    2.10 +	virtual ECursorType getCursor() const		{ return mCurrentCursor; }
    2.11 +	virtual void updateCursor() = 0;
    2.12  
    2.13  	virtual void captureMouse() = 0;
    2.14  	virtual void releaseMouse() = 0;
    2.15 @@ -227,6 +228,7 @@
    2.16  	LLWindowResolution* mSupportedResolutions;
    2.17  	S32			mNumSupportedResolutions;
    2.18  	ECursorType	mCurrentCursor;
    2.19 +	ECursorType	mNextCursor;
    2.20  	BOOL		mCursorHidden;
    2.21  	S32			mBusyCount;	// how deep is the "cursor busy" stack?
    2.22  	BOOL		mIsMouseClipping;  // Is this window currently clipping the mouse
     3.1 --- a/indra/llwindow/llwindowheadless.h	Tue Dec 13 23:13:31 2011 +0100
     3.2 +++ b/indra/llwindow/llwindowheadless.h	Sun Dec 18 13:13:42 2011 +0100
     3.3 @@ -60,7 +60,7 @@
     3.4  	/*virtual*/ void showCursorFromMouseMove() {};
     3.5  	/*virtual*/ void hideCursorUntilMouseMove() {};
     3.6  	/*virtual*/ BOOL isCursorHidden() {return FALSE;};
     3.7 -	/*virtual*/ void setCursor(ECursorType cursor) {};
     3.8 +	/*virtual*/ void updateCursor() {};
     3.9  	//virtual ECursorType getCursor() { return mCurrentCursor; };
    3.10  	/*virtual*/ void captureMouse() {};
    3.11  	/*virtual*/ void releaseMouse() {};
     4.1 --- a/indra/llwindow/llwindowmacosx.cpp	Tue Dec 13 23:13:31 2011 +0100
     4.2 +++ b/indra/llwindow/llwindowmacosx.cpp	Sun Dec 18 13:13:42 2011 +0100
     4.3 @@ -1165,6 +1165,8 @@
     4.4  
     4.5  		}
     4.6  	}
     4.7 +
     4.8 +	updateCursor();
     4.9  }
    4.10  
    4.11  BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position)
    4.12 @@ -2776,30 +2778,30 @@
    4.13  	gCursors[cursorid] = createImageCursor(fullpath.c_str(), hotspotX, hotspotY);
    4.14  }
    4.15  
    4.16 -void LLWindowMacOSX::setCursor(ECursorType cursor)
    4.17 +void LLWindowMacOSX::updateCursor()
    4.18  {
    4.19  	OSStatus result = noErr;
    4.20  
    4.21 -	if (cursor == UI_CURSOR_ARROW
    4.22 +	if (mNextCursor == UI_CURSOR_ARROW
    4.23  		&& mBusyCount > 0)
    4.24  	{
    4.25 -		cursor = UI_CURSOR_WORKING;
    4.26 +		mNextCursor = UI_CURSOR_WORKING;
    4.27  	}
    4.28  	
    4.29 -	if(mCurrentCursor == cursor)
    4.30 +	if(mCurrentCursor == mNextCursor)
    4.31  		return;
    4.32  
    4.33  	// RN: replace multi-drag cursors with single versions
    4.34 -	if (cursor == UI_CURSOR_ARROWDRAGMULTI)
    4.35 +	if (mNextCursor == UI_CURSOR_ARROWDRAGMULTI)
    4.36  	{
    4.37 -		cursor = UI_CURSOR_ARROWDRAG;
    4.38 +		mNextCursor = UI_CURSOR_ARROWDRAG;
    4.39  	}
    4.40 -	else if (cursor == UI_CURSOR_ARROWCOPYMULTI)
    4.41 +	else if (mNextCursor == UI_CURSOR_ARROWCOPYMULTI)
    4.42  	{
    4.43 -		cursor = UI_CURSOR_ARROWCOPY;
    4.44 +		mNextCursor = UI_CURSOR_ARROWCOPY;
    4.45  	}
    4.46  
    4.47 -	switch(cursor)
    4.48 +	switch(mNextCursor)
    4.49  	{
    4.50  	default:
    4.51  	case UI_CURSOR_ARROW:
    4.52 @@ -2851,7 +2853,7 @@
    4.53  	case UI_CURSOR_TOOLPLAY:
    4.54  	case UI_CURSOR_TOOLPAUSE:
    4.55  	case UI_CURSOR_TOOLMEDIAOPEN:
    4.56 -		result = setImageCursor(gCursors[cursor]);
    4.57 +		result = setImageCursor(gCursors[mNextCursor]);
    4.58  		break;
    4.59  
    4.60  	}
    4.61 @@ -2861,7 +2863,7 @@
    4.62  		InitCursor();
    4.63  	}
    4.64  
    4.65 -	mCurrentCursor = cursor;
    4.66 +	mCurrentCursor = mNextCursor;
    4.67  }
    4.68  
    4.69  ECursorType LLWindowMacOSX::getCursor() const
     5.1 --- a/indra/llwindow/llwindowmacosx.h	Tue Dec 13 23:13:31 2011 +0100
     5.2 +++ b/indra/llwindow/llwindowmacosx.h	Sun Dec 18 13:13:42 2011 +0100
     5.3 @@ -70,7 +70,7 @@
     5.4  	/*virtual*/ void showCursorFromMouseMove();
     5.5  	/*virtual*/ void hideCursorUntilMouseMove();
     5.6  	/*virtual*/ BOOL isCursorHidden();
     5.7 -	/*virtual*/ void setCursor(ECursorType cursor);
     5.8 +	/*virtual*/ void updateCursor();
     5.9  	/*virtual*/ ECursorType getCursor() const;
    5.10  	/*virtual*/ void captureMouse();
    5.11  	/*virtual*/ void releaseMouse();
     6.1 --- a/indra/llwindow/llwindowmesaheadless.h	Tue Dec 13 23:13:31 2011 +0100
     6.2 +++ b/indra/llwindow/llwindowmesaheadless.h	Sun Dec 18 13:13:42 2011 +0100
     6.3 @@ -64,7 +64,7 @@
     6.4  	/*virtual*/ void showCursorFromMouseMove() {};
     6.5  	/*virtual*/ void hideCursorUntilMouseMove() {};
     6.6  	/*virtual*/ BOOL isCursorHidden() {return FALSE;};
     6.7 -	/*virtual*/ void setCursor(ECursorType cursor) {};
     6.8 +	/*virtual*/ void updateCursor();
     6.9  	//virtual ECursorType getCursor() { return mCurrentCursor; };
    6.10  	/*virtual*/ void captureMouse() {};
    6.11  	/*virtual*/ void releaseMouse() {};
     7.1 --- a/indra/llwindow/llwindowsdl.cpp	Tue Dec 13 23:13:31 2011 +0100
     7.2 +++ b/indra/llwindow/llwindowsdl.cpp	Sun Dec 18 13:13:42 2011 +0100
     7.3 @@ -1783,6 +1783,8 @@
     7.4          }
     7.5      }
     7.6  
     7.7 +	updateCursor();
     7.8 +
     7.9  #if LL_X11
    7.10      // This is a good time to stop flashing the icon if our mFlashTimer has
    7.11      // expired.
    7.12 @@ -1868,7 +1870,7 @@
    7.13  	return sdlcursor;
    7.14  }
    7.15  
    7.16 -void LLWindowSDL::setCursor(ECursorType cursor)
    7.17 +void LLWindowSDL::updateCursor()
    7.18  {
    7.19  	if (ATIbug) {
    7.20  		// cursor-updating is very flaky when this bug is
    7.21 @@ -1876,11 +1878,11 @@
    7.22  		return;
    7.23  	}
    7.24  
    7.25 -	if (mCurrentCursor != cursor)
    7.26 +	if (mCurrentCursor != mNextCursor)
    7.27  	{
    7.28 -		if (cursor < UI_CURSOR_COUNT)
    7.29 +		if (mNextCursor < UI_CURSOR_COUNT)
    7.30  		{
    7.31 -			SDL_Cursor *sdlcursor = mSDLCursors[cursor];
    7.32 +			SDL_Cursor *sdlcursor = mSDLCursors[mNextCursor];
    7.33  			// Try to default to the arrow for any cursors that
    7.34  			// did not load correctly.
    7.35  			if (!sdlcursor && mSDLCursors[UI_CURSOR_ARROW])
    7.36 @@ -1888,9 +1890,9 @@
    7.37  			if (sdlcursor)
    7.38  				SDL_SetCursor(sdlcursor);
    7.39  		} else {
    7.40 -			llwarns << "Tried to set invalid cursor number " << cursor << llendl;
    7.41 +			llwarns << "Tried to set invalid cursor number " << mNextCursor << llendl;
    7.42  		}
    7.43 -		mCurrentCursor = cursor;
    7.44 +		mCurrentCursor = mNextCursor;
    7.45  	}
    7.46  }
    7.47  
     8.1 --- a/indra/llwindow/llwindowsdl.h	Tue Dec 13 23:13:31 2011 +0100
     8.2 +++ b/indra/llwindow/llwindowsdl.h	Sun Dec 18 13:13:42 2011 +0100
     8.3 @@ -78,7 +78,7 @@
     8.4  	/*virtual*/ void showCursorFromMouseMove();
     8.5  	/*virtual*/ void hideCursorUntilMouseMove();
     8.6  	/*virtual*/ BOOL isCursorHidden();
     8.7 -	/*virtual*/ void setCursor(ECursorType cursor);
     8.8 +	/*virtual*/ void updateCursor();
     8.9  	/*virtual*/ void captureMouse();
    8.10  	/*virtual*/ void releaseMouse();
    8.11  	/*virtual*/ void setMouseClipping( BOOL b );
     9.1 --- a/indra/llwindow/llwindowwin32.cpp	Tue Dec 13 23:13:31 2011 +0100
     9.2 +++ b/indra/llwindow/llwindowwin32.cpp	Sun Dec 18 13:13:42 2011 +0100
     9.3 @@ -1578,18 +1578,18 @@
     9.4  
     9.5  
     9.6  
     9.7 -void LLWindowWin32::setCursor(ECursorType cursor)
     9.8 +void LLWindowWin32::updateCursor()
     9.9  {
    9.10 -	if (cursor == UI_CURSOR_ARROW
    9.11 +	if (mNextCursor == UI_CURSOR_ARROW
    9.12  		&& mBusyCount > 0)
    9.13  	{
    9.14 -		cursor = UI_CURSOR_WORKING;
    9.15 +		mNextCursor = UI_CURSOR_WORKING;
    9.16  	}
    9.17  
    9.18 -	if( mCurrentCursor != cursor )
    9.19 +	if( mCurrentCursor != mNextCursor )
    9.20  	{
    9.21 -		mCurrentCursor = cursor;
    9.22 -		SetCursor( mCursor[cursor] );
    9.23 +		mCurrentCursor = mNextCursor;
    9.24 +		SetCursor( mCursor[mNextCursor] );
    9.25  	}
    9.26  }
    9.27  
    9.28 @@ -1669,6 +1669,8 @@
    9.29  
    9.30  	mInputProcessingPaused = FALSE;
    9.31  
    9.32 +	updateCursor();
    9.33 +
    9.34  	// clear this once we've processed all mouse messages that might have occurred after
    9.35  	// we slammed the mouse position
    9.36  	mMousePositionModified = FALSE;
    10.1 --- a/indra/llwindow/llwindowwin32.h	Tue Dec 13 23:13:31 2011 +0100
    10.2 +++ b/indra/llwindow/llwindowwin32.h	Sun Dec 18 13:13:42 2011 +0100
    10.3 @@ -69,7 +69,7 @@
    10.4  	/*virtual*/ void showCursorFromMouseMove();
    10.5  	/*virtual*/ void hideCursorUntilMouseMove();
    10.6  	/*virtual*/ BOOL isCursorHidden();
    10.7 -	/*virtual*/ void setCursor(ECursorType cursor);
    10.8 +	/*virtual*/ void updateCursor();
    10.9  	/*virtual*/ ECursorType getCursor() const;
   10.10  	/*virtual*/ void captureMouse();
   10.11  	/*virtual*/ void releaseMouse();

mercurial