From: Santino Mazza smazza@codeweavers.com
--- dlls/win32u/input.c | 10 ++++++---- dlls/win32u/ntuser_private.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index 084ee561f30..d5ecbb33958 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -1991,7 +1991,7 @@ static HWND set_focus_window( HWND hwnd ) BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new_active_thread_id ) { HWND previous = get_active_window(); - BOOL ret; + BOOL ret = TRUE; DWORD old_thread, new_thread; CBTACTIVATESTRUCT cbt;
@@ -2005,6 +2005,7 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new cbt.fMouse = mouse; cbt.hWndActive = previous; if (call_hooks( WH_CBT, HCBT_ACTIVATE, (WPARAM)hwnd, (LPARAM)&cbt, sizeof(cbt) )) return FALSE; + if (previous) win_set_flags(previous, WIN_IS_DEACTIVATING, 0);
if (is_window( previous )) { @@ -2020,7 +2021,7 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new previous = wine_server_ptr_handle( reply->previous ); } SERVER_END_REQ; - if (!ret) return FALSE; + if (!ret) goto done; if (prev) *prev = previous; if (previous == hwnd) goto done;
@@ -2032,7 +2033,7 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new if (send_message( hwnd, WM_QUERYNEWPALETTE, 0, 0 )) send_message_timeout( HWND_BROADCAST, WM_PALETTEISCHANGING, (WPARAM)hwnd, 0, SMTO_ABORTIFHUNG, 2000, FALSE ); - if (!is_window(hwnd)) return FALSE; + if (!(ret = is_window(hwnd))) goto done; }
old_thread = previous ? get_window_thread( previous, NULL ) : 0; @@ -2091,12 +2092,13 @@ BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, DWORD new }
done: + if (previous) win_set_flags(previous, 0, WIN_IS_DEACTIVATING); if (hwnd) { if (hwnd == NtUserGetForegroundWindow()) user_driver->pActivateWindow( hwnd, previous ); clip_fullscreen_window( hwnd, FALSE ); } - return TRUE; + return ret; }
/********************************************************************** diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 1d0131e5886..0be90de5663 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -87,6 +87,7 @@ typedef struct tagWND #define WIN_NEEDS_SHOW_OWNEDPOPUP 0x0020 /* WM_SHOWWINDOW:SC_SHOW must be sent in the next ShowOwnedPopup call */ #define WIN_CHILDREN_MOVED 0x0040 /* children may have moved, ignore stored positions */ #define WIN_HAS_IME_WIN 0x0080 /* the window has been registered with imm32 */ +#define WIN_IS_DEACTIVATING 0x0100 /* window is being deactivated */
#define WND_OTHER_PROCESS ((WND *)1) /* returned by get_win_ptr on unknown window handles */ #define WND_DESKTOP ((WND *)2) /* returned by get_win_ptr on the desktop window */