From: Mark Harmstone Subject: [PATCH] user32: send correct WM_NCACTIVATE message if invisible window gets focus Message-Id: <54ECF48B.4070701@burntcomma.com> Date: Tue, 24 Feb 2015 22:00:43 +0000 The wParam of a WM_NCACTIVATE message specifies whether a window's titlebar is active or inactive. When SetFocus is called on an invisible, Windows sends 1 here, while Wine sends 0. When Wine is drawing its own decorations, this results in a bug where the titlebar is drawn inactive on a new window where SetFocus has been called before ShowWindow, as happens with Wine notepad and winecfg. --- dlls/user32/focus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c index c47a82d..0a6aece 100644 --- a/dlls/user32/focus.c +++ b/dlls/user32/focus.c @@ -150,7 +150,7 @@ static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus ) if (IsWindow(hwnd)) { - SendMessageW( hwnd, WM_NCACTIVATE, (hwnd == GetForegroundWindow()), (LPARAM)previous ); + SendMessageW( hwnd, WM_NCACTIVATE, (hwnd == GetForegroundWindow() || !IsWindowVisible(hwnd)), (LPARAM)previous ); SendMessageW( hwnd, WM_ACTIVATE, MAKEWPARAM( mouse ? WA_CLICKACTIVE : WA_ACTIVE, IsIconic(hwnd) ), (LPARAM)previous );