[PATCH 3/6] user32: Call set_active_window from internal handler.
Rémi Bernon
rbernon at codeweavers.com
Mon Apr 27 02:06:23 CDT 2020
We could also pass the mouse param through, but it wasn't before so we
should keep the behavior unchanged.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/user32/focus.c | 10 +++++-----
dlls/user32/message.c | 2 +-
dlls/user32/user_private.h | 1 +
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c
index f1c883167ed5..09194bb08a78 100644
--- a/dlls/user32/focus.c
+++ b/dlls/user32/focus.c
@@ -74,7 +74,7 @@ static HWND set_focus_window( HWND hwnd )
/*******************************************************************
* set_active_window
*/
-static BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus )
+BOOL set_active_window( HWND hwnd, HWND *prev, BOOL mouse, BOOL focus, BOOL internal )
{
HWND previous = GetActiveWindow();
BOOL ret;
@@ -202,12 +202,12 @@ static BOOL set_foreground_window( HWND hwnd, BOOL mouse )
if (send_msg_old) /* old window belongs to other thread */
SendNotifyMessageW( previous, WM_WINE_SETACTIVEWINDOW, 0, 0 );
else if (send_msg_new) /* old window belongs to us but new one to other thread */
- ret = set_active_window( 0, NULL, mouse, TRUE );
+ ret = set_active_window( 0, NULL, mouse, TRUE, FALSE );
if (send_msg_new) /* new window belongs to other thread */
SendNotifyMessageW( hwnd, WM_WINE_SETACTIVEWINDOW, (WPARAM)hwnd, 0 );
else /* new window belongs to us */
- ret = set_active_window( hwnd, NULL, mouse, TRUE );
+ ret = set_active_window( hwnd, NULL, mouse, TRUE, FALSE );
}
return ret;
}
@@ -249,7 +249,7 @@ HWND WINAPI SetActiveWindow( HWND hwnd )
return GetActiveWindow(); /* Windows doesn't seem to return an error here */
}
- if (!set_active_window( hwnd, &prev, FALSE, TRUE )) return 0;
+ if (!set_active_window( hwnd, &prev, FALSE, TRUE, FALSE )) return 0;
return prev;
}
@@ -296,7 +296,7 @@ HWND WINAPI SetFocus( HWND hwnd )
/* activate hwndTop if needed. */
if (hwndTop != GetActiveWindow())
{
- if (!set_active_window( hwndTop, NULL, FALSE, FALSE )) return 0;
+ if (!set_active_window( hwndTop, NULL, FALSE, FALSE, FALSE )) return 0;
if (!IsWindow( hwnd )) return 0; /* Abort if window destroyed */
/* Do not change focus if the window is no longer active */
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index af909f61f6d8..0f55f6ad1b3b 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -1874,7 +1874,7 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR
return WIN_SetStyle(hwnd, wparam, lparam);
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, FALSE, TRUE, TRUE );
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 7e294558ef12..2f46908fa0a1 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -231,6 +231,7 @@ struct tagWND;
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, BOOL mouse, BOOL focus, BOOL internal ) 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;
--
2.26.1
More information about the wine-devel
mailing list