From: Twaik Yont <9674930+twaik@users.noreply.github.com> When set_active_window() is called while NtUserGetForegroundWindow() returns NULL, WM_NCACTIVATE was sent with wParam=FALSE, causing the title bar to be painted as inactive even though the window is being activated. This can happen in two cases: before any foreground window has been established (e.g. on startup), or after winex11 explicitly resets the foreground to the desktop window via NtUserSetForegroundWindowInternal on focus loss, which the server handles by setting foreground_input to NULL since the desktop cannot be a foreground window. If there is no foreground window, treat the window being activated as if it were the foreground window for the purpose of WM_NCACTIVATE. --- dlls/win32u/input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 733eb604fdc..ed300cd9c3a 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2085,7 +2085,8 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new if (is_window(hwnd)) { - send_message( hwnd, WM_NCACTIVATE, hwnd == NtUserGetForegroundWindow(), (LPARAM)previous ); + HWND foreground = NtUserGetForegroundWindow(); + send_message( hwnd, WM_NCACTIVATE, !foreground || hwnd == foreground, (LPARAM)previous ); send_message( hwnd, WM_ACTIVATE, MAKEWPARAM( mouse ? WA_CLICKACTIVE : WA_ACTIVE, is_iconic(hwnd) ? 0x20 : 0 ), (LPARAM)previous ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11074