FIRE-3798/STORM-1713: Linden Lab approved version of the fix for mouse cursor flickering when hovered over inworld objects

Ansariel 2011-12-08 18:20:08 +01:00
parent 36c538f8a7
commit 0a14d57cdb
12 changed files with 43 additions and 59 deletions

View File

@ -328,20 +328,11 @@ BOOL LLToolTip::handleHover(S32 x, S32 y, MASK mask)
if(mInfoButton)
mInfoButton->setHighlight(true);
// Ansariel - FIRE-3798:
// Don't call handleHover on the panel if we set the cursor ourself!
// It will traverse down the control hierarchy and finally the hover
// is handled by LLButton, that will set the cursor to UI_CURSOR_ARROW,
// resulting in a flickering cursor!
//LLPanel::handleHover(x, y, mask);
LLPanel::handleHover(x, y, mask);
if (mHasClickCallback)
{
getWindow()->setCursor(UI_CURSOR_HAND);
}
else
{
LLPanel::handleHover(x, y, mask);
}
return TRUE;
}

View File

@ -812,30 +812,14 @@ LLView* LLView::childrenHandleHover(S32 x, S32 y, MASK mask)
}
// This call differentiates this method from childrenHandleMouseEvent().
// <Ansariel> Proper fix for FIRE-3798: Original fix by Tank caused
// cursor to not properly update when hovering over UI elements.
// Fix resembles old algorithm for childrenHandleHover.
//LLUI::sWindow->setCursor(viewp->getHoverCursor());
LLUI::sWindow->setCursor(viewp->getHoverCursor());
//if (viewp->handleHover(local_x, local_y, mask)
// || viewp->blockMouseEvent(local_x, local_y))
//{
// viewp->logMouseEvent();
// return viewp;
//}
if (viewp->handleHover(local_x, local_y, mask))
if (viewp->handleHover(local_x, local_y, mask)
|| viewp->blockMouseEvent(local_x, local_y))
{
viewp->logMouseEvent();
return viewp;
}
if (viewp->blockMouseEvent(local_x, local_y))
{
LLUI::sWindow->setCursor(viewp->getHoverCursor());
return viewp;
}
// </Ansariel>
}
return NULL;
}

View File

@ -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),

View File

@ -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;
@ -186,6 +187,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

View File

@ -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() {};

View File

@ -1166,6 +1166,8 @@ void LLWindowMacOSX::gatherInput()
}
}
updateCursor();
}
BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position)
@ -2846,7 +2848,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;
@ -2854,30 +2856,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:
@ -2929,7 +2931,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
case UI_CURSOR_TOOLBUY:
case UI_CURSOR_TOOLPAY:
case UI_CURSOR_TOOLOPEN:
result = setImageCursor(gCursors[cursor]);
result = setImageCursor(gCursors[mNextCursor]);
break;
}
@ -2939,7 +2941,7 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
InitCursor();
}
mCurrentCursor = cursor;
mCurrentCursor = mNextCursor;
}
ECursorType LLWindowMacOSX::getCursor() const

View File

@ -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();

View File

@ -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() {};

View File

@ -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;
}
}

View File

@ -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 );

View File

@ -1626,18 +1626,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] );
}
}
@ -1719,6 +1719,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;

View File

@ -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();