From b159ee4f5caa71a85a9ebfa8ee9558a7fcbb8929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 11 Aug 2022 23:13:56 +0200 Subject: Fix bug in CenterNextWindow. --- c/win.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/c/win.cpp b/c/win.cpp index a68d5b3..97e85a4 100644 --- a/c/win.cpp +++ b/c/win.cpp @@ -36,9 +36,13 @@ static void CenterNextWindow(HWND hWnd) * is delayed until the new window is activated. This * complicates the code somewhat. */ - static __thread HWND hWndParent = hWnd; - static __thread HWND hWndNext = nullptr; - static __thread HHOOK hHook = Require(SetWindowsHookEx(WH_CBT, [](const int nCode, + static __thread HWND hWndParent; + static __thread HWND hWndNext; + static __thread HHOOK hHook; + + hWndParent = hWnd; + hWndNext = nullptr; + hHook = Require(SetWindowsHookEx(WH_CBT, [](const int nCode, const WPARAM wParam, const LPARAM lParam) noexcept -> LRESULT CALLBACK { if (!hWndNext && nCode == HCBT_CREATEWND) { -- cgit v1.2.3