From 133f112af0e26746303556ef37059f6485e092b3 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 15 Jan 2019 20:26:33 +0100 Subject: [PATCH] Examples: Win32: Using GetForegroundWindow() instead of GetActiveWindow() to be compatible with windows created in a different thread. (#1951, #2087, #2156, #2232) [many people] --- docs/CHANGELOG.txt | 4 ++++ examples/imgui_impl_win32.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 840e8aa9..79a9a644 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -33,6 +33,10 @@ HOW TO UPDATE? VERSION 1.68 ----------------------------------------------------------------------- +Other Changes: +- Examples: Win32: Using GetForegroundWindow() instead of GetActiveWindow() to be compatible with windows created + in a different thread. (#1951, #2087, #2156, #2232) [many people] + ----------------------------------------------------------------------- VERSION 1.67 (Released 2019-01-14) diff --git a/examples/imgui_impl_win32.cpp b/examples/imgui_impl_win32.cpp index 402025b3..be983fd5 100644 --- a/examples/imgui_impl_win32.cpp +++ b/examples/imgui_impl_win32.cpp @@ -18,6 +18,7 @@ // CHANGELOG // (minor and older changes stripped away, please see git history for details) +// 2019-01-15: Inputs: Using GetForegroundWindow() instead of GetActiveWindow() to be compatible with windows created in a different thread. // 2018-11-30: Misc: Setting up io.BackendPlatformName so it can be displayed in the About Window. // 2018-06-29: Inputs: Added support for the ImGuiMouseCursor_Hand cursor. // 2018-06-10: Inputs: Fixed handling of mouse wheel messages to support fine position messages (typically sent by track-pads). @@ -134,7 +135,7 @@ static void ImGui_ImplWin32_UpdateMousePos() // Set mouse position io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX); POINT pos; - if (::GetActiveWindow() == g_hWnd && ::GetCursorPos(&pos)) + if (::GetForegroundWindow() == g_hWnd && ::GetCursorPos(&pos)) if (::ScreenToClient(g_hWnd, &pos)) io.MousePos = ImVec2((float)pos.x, (float)pos.y); }