From Roland Smeenk, "Attached is a small bug fix for the redundant messages that are created in OSG applications on windows. GraphicsWindowWin32::setCursor is called every frame from the WM_NCHITTEST message. This will result in a call to ::SetCursor(_currentCursor) every frame, which again causes a WM_MOUSEMOVE to occur. The fix exits GraphicsWindowWin32::setCursor if the requested cursor already is the current cursor.

"
This commit is contained in:
Robert Osfield
2009-02-27 11:11:06 +00:00
parent 898a313272
commit eef4801ba7

View File

@@ -1935,25 +1935,28 @@ void GraphicsWindowWin32::useCursor( bool cursorOn )
void GraphicsWindowWin32::setCursor( MouseCursor mouseCursor )
{
if (mouseCursor != LeftRightCursor &&
mouseCursor != UpDownCursor &&
mouseCursor != TopLeftCorner &&
mouseCursor != TopRightCorner &&
mouseCursor != BottomLeftCorner &&
mouseCursor != BottomRightCorner)
if (_mouseCursor != mouseCursor)
{
_appMouseCursor = 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);
}
_mouseCursor = mouseCursor;
HCURSOR newCursor = getOrCreateCursor( mouseCursor);
if (newCursor == _currentCursor) return;
_currentCursor = newCursor;
_traits->useCursor = (_currentCursor != NULL);
if (_mouseCursor != InheritCursor)
::SetCursor(_currentCursor);
}
HCURSOR GraphicsWindowWin32::getOrCreateCursor(MouseCursor mouseCursor)