From 781b6d7f6937f0a492ff2aca0c0c16c1eb2a9586 Mon Sep 17 00:00:00 2001 From: Doug Binks Date: Mon, 18 Apr 2016 12:17:06 +0100 Subject: [PATCH] Fixes #740 - size callbacks incorrect on monitor orientation change in windows --- src/win32_window.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index ed6bbe7f6..2f5f49637 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -637,8 +637,17 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, _glfwInputWindowIconify(window, GLFW_FALSE); } - _glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam)); - _glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam)); + // WM_SIZE params do not appear to catch display orientation + // changes correctly, so use Get functions to retreive. + // Both framebuffer and window sizes are the same, but get both + // here for potential future proofing. + int fbwidth, fbheight; + _glfwPlatformGetFramebufferSize(window, &fbwidth, &fbheight); + _glfwInputFramebufferSize(window, fbwidth, fbheight); + + int wwidth, wheight; + _glfwPlatformGetWindowSize(window, &wwidth, &wheight); + _glfwInputWindowSize(window, wwidth, wheight); return 0; }