From 97dbd8b63bbd15bb781e54a670b183dbd59f1bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 14 Mar 2017 19:21:52 +0100 Subject: [PATCH] Win32: Fix monitor event emission Fixes #784. --- README.md | 1 + src/win32_init.c | 4 ++-- src/win32_window.c | 11 +++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ad87fa02..eadb2736 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,7 @@ information on what to include when reporting a bug. - [Win32] Bugfix: The 32-bit Vulkan loader library static was not searched for - [Win32] Bugfix: Vulkan libraries have a new path as of SDK 1.0.42.0 (#956) - [Win32] Bugfix: Monitors with no display devices were not enumerated (#960) +- [Win32] Bugfix: Monitor events were not emitted (#784) - [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading - [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X - [X11] Bugfix: Dynamic X11 library loading did not use full sonames (#941) diff --git a/src/win32_init.c b/src/win32_init.c index b092d1c7..785d75d3 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -307,10 +307,10 @@ static HWND createHelperWindow(void) MSG msg; HWND window = CreateWindowExW(WS_EX_OVERLAPPEDWINDOW, _GLFW_WNDCLASSNAME, - L"GLFW helper window", + L"GLFW message window", WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0, 0, 1, 1, - HWND_MESSAGE, NULL, + NULL, NULL, GetModuleHandleW(NULL), NULL); if (!window) diff --git a/src/win32_window.c b/src/win32_window.c index 1e0a587e..7f8a63b2 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -467,14 +467,13 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, switch (uMsg) { + case WM_DISPLAYCHANGE: + _glfwPollMonitorsWin32(); + break; + case WM_DEVICECHANGE: { - if (wParam == DBT_DEVNODES_CHANGED) - { - _glfwPollMonitorsWin32(); - return TRUE; - } - else if (wParam == DBT_DEVICEARRIVAL) + if (wParam == DBT_DEVICEARRIVAL) { DEV_BROADCAST_HDR* dbh = (DEV_BROADCAST_HDR*) lParam; if (dbh)