From cbd0e93d0f78ac9614ec21f450d31484b4e8273e Mon Sep 17 00:00:00 2001 From: Luiz Monclar Date: Wed, 17 Apr 2019 01:51:24 -0300 Subject: [PATCH 1/4] Replace 'GetActiveWindow()' calls with 'GetForegroundWindow()' for the win32 platform --- src/win32_window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index c022b5bae..228585e9d 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1788,7 +1788,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, int _glfwPlatformWindowFocused(_GLFWwindow* window) { - return window->win32.handle == GetActiveWindow(); + return window->win32.handle == GetForegroundWindow(); } int _glfwPlatformWindowIconified(_GLFWwindow* window) @@ -1918,7 +1918,7 @@ void _glfwPlatformPollEvents(void) } } - handle = GetActiveWindow(); + handle = GetForegroundWindow(); if (handle) { // NOTE: Shift keys on Windows tend to "stick" when both are pressed as From 0678c6ca1e124e9f6976367d2771cdff1a467804 Mon Sep 17 00:00:00 2001 From: Luiz Gustavo Gomes Monclar Date: Wed, 17 Apr 2019 02:18:33 -0300 Subject: [PATCH 2/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3fce2f8c2..d871e59d1 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ information on what to include when reporting a bug. ## Changelog -User-visible changes since the last release. +* [Win32] Bugfix: Worker threads are now able to correctly detect if the window has focus by getting the `GLFW_FOCUSED` attribute. ## Contact From 906542f2bb9e628c38df73d924db30fae9ca271d Mon Sep 17 00:00:00 2001 From: Luiz Monclar Date: Wed, 17 Apr 2019 02:33:49 -0300 Subject: [PATCH 3/4] Revert the replacement in the '_glfwPlatformPollEvents' function, as it could wrongfully read inputs from other windows --- src/win32_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win32_window.c b/src/win32_window.c index 228585e9d..d6c28fb9c 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1918,7 +1918,7 @@ void _glfwPlatformPollEvents(void) } } - handle = GetForegroundWindow(); + handle = GetActiveWindow(); if (handle) { // NOTE: Shift keys on Windows tend to "stick" when both are pressed as From c6879c1c9c6f1fbb20c3922b9d9e9b1521e6e35a Mon Sep 17 00:00:00 2001 From: Luiz Gustavo Gomes Monclar Date: Wed, 17 Apr 2019 02:44:37 -0300 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d871e59d1..40719689d 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ information on what to include when reporting a bug. ## Changelog -* [Win32] Bugfix: Worker threads are now able to correctly detect if the window has focus by getting the `GLFW_FOCUSED` attribute. +* [Win32] Bugfix: Worker threads are now able to correctly detect if the GLFW window has focus by getting the `GLFW_FOCUSED` attribute. ## Contact