X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmswin%2Ffg_main_mswin.c;h=bf02a7eb534c878207a7e509ce7edf264a934bb3;hb=77ee35c8d522dddac4e2c88e8de166491d4d762c;hp=e4fcce5689329f1c05d270a54fd4e08687304bc8;hpb=2a3de201be57b04bff0a26a7607bc1d6fef2ea88;p=freeglut diff --git a/src/mswin/fg_main_mswin.c b/src/mswin/fg_main_mswin.c index e4fcce5..bf02a7e 100644 --- a/src/mswin/fg_main_mswin.c +++ b/src/mswin/fg_main_mswin.c @@ -361,6 +361,7 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR { SFG_Window *window; LRESULT lRet = 1; + static int setCaptureActive = 0; FREEGLUT_INTERNAL_ERROR_EXIT_IF_NOT_INITIALISED ( "Event Handler" ) ; @@ -743,7 +744,11 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR * 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 () ; @@ -864,6 +869,9 @@ LRESULT CALLBACK fgPlatformWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPAR 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 */