From Frederic Bouvier, SetCursor fixes from GraphicsWindowWin32,

Original email from Frederic at start of thread:
"he patch attached, made from r10068, fix two things, in other of importance :

- the selected cursor is never shown ( second change in file ). Only the left arrow is always displayed.
- remove the arbitrary ( in my sense ) limitation that the user cannot choose a cursor with the same shape that one used when resizing the window. This limitation doesn't exist for X11, and we have a diverging behaviour there ( first change in file ). Flightgear use the LeftRightCursor in look around mode."

Follow up email from Frederic (with changes that finally made it into this check in:
"I've just tested Mark's suggestion and it works perfectly, even when the
cursor goes to the border then come back inside the window.
But his patch doesn't seem to be based on the last revision of the
files, or at least not on the trunk, and there are more changes than
expected in them, including some loss from the previous patches.
The patch attached is based on r10068 of
src/osgViewer/GraphicsWindowWin32.cpp and r10067 of
include/osgViewer/api/Win32/GraphicsWindowWin32"
This commit is contained in:
Robert Osfield
2009-05-07 13:30:54 +00:00
parent d62721c029
commit 7ea1a97afd
2 changed files with 17 additions and 19 deletions

View File

@@ -1939,26 +1939,22 @@ void GraphicsWindowWin32::useCursor( bool cursorOn )
}
void GraphicsWindowWin32::setCursor( MouseCursor mouseCursor )
{
_appMouseCursor = mouseCursor;
setCursorImpl(mouseCursor);
}
void GraphicsWindowWin32::setCursorImpl( MouseCursor mouseCursor )
{
if (_mouseCursor != mouseCursor)
{
if (mouseCursor != LeftRightCursor &&
mouseCursor != UpDownCursor &&
mouseCursor != TopLeftCorner &&
mouseCursor != TopRightCorner &&
mouseCursor != BottomLeftCorner &&
mouseCursor != BottomRightCorner)
{
_appMouseCursor = mouseCursor;
}
_mouseCursor = mouseCursor;
HCURSOR newCursor = getOrCreateCursor( mouseCursor);
if (newCursor == _currentCursor) return;
_currentCursor = newCursor;
_traits->useCursor = (_currentCursor != NULL);
if (_mouseCursor != InheritCursor)
::SetCursor(_currentCursor);
}
@@ -2354,28 +2350,28 @@ LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, W
{
case HTLEFT:
case HTRIGHT:
setCursor(LeftRightCursor);
setCursorImpl(LeftRightCursor);
break;
case HTTOP:
case HTBOTTOM:
setCursor(UpDownCursor);
setCursorImpl(UpDownCursor);
break;
case HTTOPLEFT:
setCursor(TopLeftCorner);
setCursorImpl(TopLeftCorner);
break;
case HTTOPRIGHT:
setCursor(TopRightCorner);
setCursorImpl(TopRightCorner);
break;
case HTBOTTOMLEFT:
setCursor(BottomLeftCorner);
setCursorImpl(BottomLeftCorner);
break;
case HTBOTTOMRIGHT:
case HTGROWBOX:
setCursor(BottomRightCorner);
setCursorImpl(BottomRightCorner);
break;
default:
if (_traits->useCursor && _appMouseCursor != InheritCursor)
setCursor(LeftArrowCursor);
setCursorImpl(_appMouseCursor);
break;
}
return result;