From Alexander Sinditskiy, "I found issue with capturing mouse buttons.
This issue can be reproduced: 1. Create osgViewer window, 2. Push right&left mouse buttons on the osgViewer window, 3. Move mouse out of window, and release right&left mouse buttons. osgViewer window handle only first mouse release, as result window thinks that we did not released second mouse button. I attached fix for this issue."
This commit is contained in:
@@ -2508,6 +2508,8 @@ LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, W
|
||||
else if (uMsg==WM_MBUTTONDOWN) button = 2;
|
||||
else button = 3;
|
||||
|
||||
_capturedMouseButtons.insert(button);
|
||||
|
||||
float mx = GET_X_LPARAM(lParam);
|
||||
float my = GET_Y_LPARAM(lParam);
|
||||
transformMouseXY(mx, my);
|
||||
@@ -2522,14 +2524,17 @@ LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, W
|
||||
/////////////////////
|
||||
|
||||
{
|
||||
::ReleaseCapture();
|
||||
|
||||
int button;
|
||||
|
||||
if (uMsg==WM_LBUTTONUP) button = 1;
|
||||
else if (uMsg==WM_MBUTTONUP) button = 2;
|
||||
else button = 3;
|
||||
|
||||
_capturedMouseButtons.erase(button);
|
||||
|
||||
if(_capturedMouseButtons.empty())
|
||||
::ReleaseCapture();
|
||||
|
||||
float mx = GET_X_LPARAM(lParam);
|
||||
float my = GET_Y_LPARAM(lParam);
|
||||
transformMouseXY(mx, my);
|
||||
@@ -2552,6 +2557,8 @@ LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, W
|
||||
else if (uMsg==WM_MBUTTONDBLCLK) button = 2;
|
||||
else button = 3;
|
||||
|
||||
_capturedMouseButtons.insert(button);
|
||||
|
||||
float mx = GET_X_LPARAM(lParam);
|
||||
float my = GET_Y_LPARAM(lParam);
|
||||
transformMouseXY(mx, my);
|
||||
@@ -2703,6 +2710,9 @@ LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, W
|
||||
key->second = false;
|
||||
}
|
||||
}
|
||||
|
||||
_capturedMouseButtons.clear();
|
||||
|
||||
break;
|
||||
|
||||
///////////////////
|
||||
|
||||
Reference in New Issue
Block a user