Fix Win32 window size event race condition

The old window size was reported after re-entering full screen and
setting and reporting the new window size.

Fixes #740.
This commit is contained in:
Camilla Berglund 2016-05-04 16:04:26 +02:00
parent 11d051b69a
commit e640d840b7
2 changed files with 18 additions and 9 deletions

View File

@ -110,6 +110,8 @@ does not find Doxygen, the documentation will not be generated.
trigger monitor callback
- [Win32] Bugfix: No monitors were listed on headless and VMware guest systems
- [Win32] Bugfix: Pressing Ctrl+Pause would report `GLFW_KEY_UNKNOWN`
- [Win32] Bugfix: Window size events would be reported in wrong order when
restoring a full screen window
- [Cocoa] Made joystick polling more efficient
- [Cocoa] Removed support for OS X 10.6
- [Cocoa] Bugfix: Full screen windows on secondary monitors were mispositioned

View File

@ -613,32 +613,39 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_SIZE:
{
const GLFWbool iconified =
!window->win32.iconified && wParam == SIZE_MINIMIZED;
const GLFWbool restored =
window->win32.iconified &&
(wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED);
if (_glfw.cursorWindow == window)
{
if (window->cursorMode == GLFW_CURSOR_DISABLED)
updateClipRect(window);
}
if (!window->win32.iconified && wParam == SIZE_MINIMIZED)
if (iconified)
_glfwInputWindowIconify(window, GLFW_TRUE);
else if (restored)
_glfwInputWindowIconify(window, GLFW_FALSE);
_glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam));
_glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam));
if (iconified)
{
window->win32.iconified = GLFW_TRUE;
if (window->monitor)
releaseMonitor(window);
_glfwInputWindowIconify(window, GLFW_TRUE);
}
else if (window->win32.iconified &&
(wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED))
else if (restored)
{
window->win32.iconified = GLFW_FALSE;
if (window->monitor)
acquireMonitor(window);
_glfwInputWindowIconify(window, GLFW_FALSE);
}
_glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam));
_glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam));
return 0;
}