Instead of SetActiveWindow, and provide a flag to indicate its internal nature.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/user32/focus.c | 6 +++--- dlls/user32/message.c | 2 +- dlls/user32/user_private.h | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c index d5add0ab197..dd4c282e63d 100644 --- a/dlls/user32/focus.c +++ b/dlls/user32/focus.c @@ -71,7 +71,7 @@ static HWND set_focus_window( HWND hwnd ) /******************************************************************* * set_active_window */ -static BOOL set_active_window( HWND hwnd, HWND *prev, UINT flags ) +BOOL set_active_window( HWND hwnd, HWND *prev, UINT flags ) { HWND previous = GetActiveWindow(); BOOL ret, mouse = (flags & SET_ACTIVE_WINDOW_FLAGS_MOUSE); @@ -197,12 +197,12 @@ static BOOL set_foreground_window( HWND hwnd, UINT flags ) if (ret && previous != hwnd) { if (send_msg_old) /* old window belongs to other thread */ - SendNotifyMessageW( previous, WM_WINE_SETACTIVEWINDOW, 0, 0 ); + SendNotifyMessageW( previous, WM_WINE_SETACTIVEWINDOW, 0, flags|SET_ACTIVE_WINDOW_FLAGS_FOCUS ); else if (send_msg_new) /* old window belongs to us but new one to other thread */ ret = set_active_window( 0, NULL, flags|SET_ACTIVE_WINDOW_FLAGS_FOCUS );
if (send_msg_new) /* new window belongs to other thread */ - SendNotifyMessageW( hwnd, WM_WINE_SETACTIVEWINDOW, (WPARAM)hwnd, 0 ); + SendNotifyMessageW( hwnd, WM_WINE_SETACTIVEWINDOW, (WPARAM)hwnd, flags|SET_ACTIVE_WINDOW_FLAGS_FOCUS ); else /* new window belongs to us */ ret = set_active_window( hwnd, NULL, flags|SET_ACTIVE_WINDOW_FLAGS_FOCUS ); } diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 02628e4b92b..2a70b57b597 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -1869,7 +1869,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR case WM_WINE_SETACTIVEWINDOW: if (!wparam && GetWindowThreadProcessId( GetForegroundWindow(), NULL ) == GetCurrentThreadId()) return 0; - return (LRESULT)SetActiveWindow( (HWND)wparam ); + return (LRESULT)set_active_window( (HWND)wparam, NULL, lparam|SET_ACTIVE_WINDOW_FLAGS_INTERNAL ); case WM_WINE_KEYBOARD_LL_HOOK: case WM_WINE_MOUSE_LL_HOOK: { diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 193fde53307..febb1bbb7bb 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -64,6 +64,7 @@ enum set_active_window_flags { SET_ACTIVE_WINDOW_FLAGS_MOUSE = 1, SET_ACTIVE_WINDOW_FLAGS_FOCUS = 2, + SET_ACTIVE_WINDOW_FLAGS_INTERNAL = 4, };
typedef struct tagUSER_DRIVER { @@ -251,6 +252,7 @@ extern struct rawinput_thread_data *rawinput_thread_data(void);
extern void CLIPBOARD_ReleaseOwner( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN; +extern BOOL set_active_window( HWND hwnd, HWND *prev, UINT flags ) DECLSPEC_HIDDEN; extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN; extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN; extern void invalidate_dce( struct tagWND *win, const RECT *rect ) DECLSPEC_HIDDEN;