From: Santino Mazza smazza@codeweavers.com
This fixes a difference in behavior between Wine and Windows, where in Wine it's possible to immediatly reactivate a window by calling SetWindowPos or SetForegroundWindow inside the WM_ACTIVATE handler. In Windows this isn't possible. --- dlls/win32u/input.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/win32u/input.c b/dlls/win32u/input.c index d5ecbb33958..830814bad80 100644 --- a/dlls/win32u/input.c +++ b/dlls/win32u/input.c @@ -2005,10 +2005,10 @@ 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 )) { + win_set_flags(previous, WIN_IS_DEACTIVATING, 0); send_message( previous, WM_NCACTIVATE, FALSE, (LPARAM)hwnd ); send_message( previous, WM_ACTIVATE, MAKEWPARAM( WA_INACTIVE, is_iconic(previous) ), (LPARAM)hwnd ); @@ -2092,7 +2092,7 @@ 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 (is_window(previous)) win_set_flags(previous, 0, WIN_IS_DEACTIVATING); if (hwnd) { if (hwnd == NtUserGetForegroundWindow()) user_driver->pActivateWindow( hwnd, previous ); @@ -2207,6 +2207,7 @@ BOOL set_foreground_window( HWND hwnd, BOOL mouse ) DWORD new_thread_id; HWND previous = 0;
+ if (win_get_flags(hwnd) & WIN_IS_DEACTIVATING) return TRUE; if (mouse) hwnd = get_full_window_handle( hwnd ); new_thread_id = get_window_thread( hwnd, NULL );