diff --git a/README.md b/README.md index 1a1f0316..ce29513e 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,7 @@ information on what to include when reporting a bug. - [Win32] Bugfix: Monitor functions could return invalid values after configuration change (#1761) - [Win32] Bugfix: Initialization would segfault on Windows 8 (not 8.1) (#1775) + - [Win32] Bugfix: Duplicate size events were not filtered (#1610) - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) - [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 (#1635) @@ -254,6 +255,7 @@ skills. - Shane Liesegang - Anders Lindqvist - Leon Linhart + - Marco Lizza - Eyal Lotem - Aaron Loucks - Luflosi diff --git a/src/win32_platform.h b/src/win32_platform.h index 7305fd28..003b8a14 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -321,6 +321,9 @@ typedef struct _GLFWwindowWin32 GLFWbool transparent; GLFWbool scaleToMonitor; + // Cached size used to filter out duplicate events + int width, height; + // The last received cursor position, regardless of source int lastCursorPosX, lastCursorPosY; // The last recevied high surrogate when decoding pairs of UTF-16 messages diff --git a/src/win32_window.c b/src/win32_window.c index f76f560f..15fe2aa9 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -954,6 +954,8 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_SIZE: { + const int width = LOWORD(lParam); + const int height = HIWORD(lParam); const GLFWbool iconified = wParam == SIZE_MINIMIZED; const GLFWbool maximized = wParam == SIZE_MAXIMIZED || (window->win32.maximized && @@ -968,8 +970,14 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, if (window->win32.maximized != maximized) _glfwInputWindowMaximize(window, maximized); - _glfwInputFramebufferSize(window, LOWORD(lParam), HIWORD(lParam)); - _glfwInputWindowSize(window, LOWORD(lParam), HIWORD(lParam)); + if (width != window->win32.width || height != window->win32.height) + { + window->win32.width = width; + window->win32.height = height; + + _glfwInputFramebufferSize(window, width, height); + _glfwInputWindowSize(window, width, height); + } if (window->monitor && window->win32.iconified != iconified) { @@ -1307,6 +1315,8 @@ static int createNativeWindow(_GLFWwindow* window, window->win32.transparent = GLFW_TRUE; } + _glfwPlatformGetWindowSize(window, &window->win32.width, &window->win32.height); + return GLFW_TRUE; }