Changeset 9824

Show
Ignore:
Timestamp:
02/27/09 12:11:06 (5 years ago)
Author:
robert
Message:

From Roland Smeenk, "Attached is a small bug fix for the redundant messages that are created in OSG applications on windows. GraphicsWindowWin?32::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 GraphicsWindowWin?32::setCursor if the requested cursor already is the current cursor.

"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgViewer/GraphicsWindowWin32.cpp

    r9729 r9824  
    19361936void GraphicsWindowWin32::setCursor( MouseCursor mouseCursor ) 
    19371937{ 
    1938     if (mouseCursor != LeftRightCursor &&  
    1939         mouseCursor != UpDownCursor &&  
    1940         mouseCursor != TopLeftCorner &&  
    1941         mouseCursor != TopRightCorner &&  
    1942         mouseCursor != BottomLeftCorner &&  
    1943         mouseCursor != BottomRightCorner) 
    1944     { 
    1945         _appMouseCursor = mouseCursor; 
    1946     } 
    1947  
    1948     _mouseCursor = mouseCursor; 
    1949     HCURSOR newCursor = getOrCreateCursor( mouseCursor); 
    1950     if (newCursor == _currentCursor) return; 
    1951  
    1952     _currentCursor = newCursor; 
    1953     _traits->useCursor = (_currentCursor != NULL); 
    1954  
    1955     if (_mouseCursor != InheritCursor) 
    1956         ::SetCursor(_currentCursor); 
     1938    if (_mouseCursor != mouseCursor) 
     1939    { 
     1940        if (mouseCursor != LeftRightCursor &&  
     1941            mouseCursor != UpDownCursor &&  
     1942            mouseCursor != TopLeftCorner &&  
     1943            mouseCursor != TopRightCorner &&  
     1944            mouseCursor != BottomLeftCorner &&  
     1945            mouseCursor != BottomRightCorner) 
     1946        { 
     1947            _appMouseCursor = mouseCursor; 
     1948        } 
     1949 
     1950        _mouseCursor = mouseCursor; 
     1951        HCURSOR newCursor = getOrCreateCursor( mouseCursor); 
     1952        if (newCursor == _currentCursor) return; 
     1953 
     1954        _currentCursor = newCursor; 
     1955        _traits->useCursor = (_currentCursor != NULL); 
     1956 
     1957        if (_mouseCursor != InheritCursor) 
     1958            ::SetCursor(_currentCursor); 
     1959    } 
    19571960} 
    19581961