[PATCH 2/2] winex11.drv: Send HTMENU instead of HTCAPTION to query window activation.

Rémi Bernon rbernon at codeweavers.com
Mon Dec 23 06:51:26 CST 2019


Commit 71d35d8940118bc6de6522913fb8c473fa5b2c24 broke the way
WM_TAKE_FOCUS protocol is implemented: WM_MOUSEACTIVATE now replies
MA_NOACTIVATE by default when using HTCAPTION.

We use the WM_MOUSEACTIVATE -although Windows does not- regardless of
the way focus is changed to check whether a window wants focus, and
Windows sometimes changes focus regardless of the message reply.

Steam and the Wine system tray are affected for instance.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

With the previous patch, it's also possible to revert
71d35d8940118bc6de6522913fb8c473fa5b2c24, but the WM_MOUSEACTIVATE reply
it changes is indeed correct.

 dlls/winex11.drv/event.c  | 2 +-
 dlls/winex11.drv/window.c | 2 +-
 dlls/winex11.drv/x11drv.h | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index 2649d561a6b..957d7c5efdf 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -714,7 +714,7 @@ static void handle_wm_protocols( HWND hwnd, XClientMessageEvent *event )
              * whether the window wants to be activated */
             LRESULT ma = SendMessageW( hwnd, WM_MOUSEACTIVATE,
                                        (WPARAM)GetAncestor( hwnd, GA_ROOT ),
-                                       MAKELONG(HTCAPTION,WM_LBUTTONDOWN) );
+                                       MAKELONG( HTMENU, WM_LBUTTONDOWN ) );
             if (ma != MA_NOACTIVATEANDEAT && ma != MA_NOACTIVATE)
             {
                 set_focus( event->display, hwnd, event_time, event->serial );
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 99e4094ebd9..89ea42b7567 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -169,7 +169,7 @@ struct has_popup_result
     BOOL found;
 };
 
-static BOOL is_managed( HWND hwnd )
+BOOL is_managed( HWND hwnd )
 {
     struct x11drv_win_data *data = get_win_data( hwnd );
     BOOL ret = data && data->managed;
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index e9b827c7e9a..0e55e5115f8 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -607,6 +607,7 @@ extern void change_systray_owner( Display *display, Window systray_window ) DECL
 extern void update_systray_balloon_position(void) DECLSPEC_HIDDEN;
 extern HWND create_foreign_window( Display *display, Window window ) DECLSPEC_HIDDEN;
 extern BOOL update_clipboard( HWND hwnd ) DECLSPEC_HIDDEN;
+extern BOOL is_managed( HWND hwnd ) DECLSPEC_HIDDEN;
 
 static inline void mirror_rect( const RECT *window_rect, RECT *rect )
 {
-- 
2.24.1




More information about the wine-devel mailing list