{
SFG_Window *window;
LRESULT lRet = 1;
+ static int setCaptureActive = 0;
FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED ( "Event Handler" ) ;
* This is consistent with the behavior on X11.
*/
if ( pressed == GL_TRUE )
- SetCapture ( window->Window.Handle ) ;
+ {
+ if (!setCaptureActive)
+ SetCapture ( window->Window.Handle ) ;
+ setCaptureActive = 1; /* Set to false in WM_CAPTURECHANGED handler */
+ }
else if (!GetAsyncKeyState(VK_LBUTTON) && !GetAsyncKeyState(VK_MBUTTON) && !GetAsyncKeyState(VK_RBUTTON))
/* Make sure all mouse buttons are released before releasing capture */
ReleaseCapture () ;
break;
case WM_CAPTURECHANGED:
+ if (!lParam || !fgWindowByHandle((HWND)lParam))
+ /* Capture released or capture taken by non-FreeGLUT window */
+ setCaptureActive = 0;
/* User has finished resizing the window, force a redraw */
INVOKE_WCB( *window, Display, ( ) );
lRet = 0; /* Per docs, should return zero */