[PATCH] user32: Allow activating desktop only when clicked directly

Fabian Maurer dark.shadow4 at web.de
Mon Aug 28 20:07:03 CDT 2017


Fixes the regression for bug Bug 43577
introduced in ae153a5c2c5590d4ea722d38eb4ddf1a7031f34a,
while keeping the feature it added.

Some programs have toplevel windows that have WS_CHILD set.
If one of those is clicked, it would activate the desktop,
but it shouldn't.

Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
---
 dlls/user32/message.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 3d3736d9c6..6e7779b853 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -2638,13 +2638,16 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
         if (msg->hwnd != info.hwndActive)
         {
             HWND hwndTop = msg->hwnd;
+            HWND desktop = GetDesktopWindow();
             while (hwndTop)
             {
                 if ((GetWindowLongW( hwndTop, GWL_STYLE ) & (WS_POPUP|WS_CHILD)) != WS_CHILD) break;
                 hwndTop = GetParent( hwndTop );
             }
 
-            if (hwndTop)
+            /* Can activate desktop, but only if it was clicked directly
+             * This check is needed since some top-level windows have WS_CHILD set */
+            if (hwndTop && (msg->hwnd == desktop || hwndTop != desktop))
             {
                 LONG ret = SendMessageW( msg->hwnd, WM_MOUSEACTIVATE, (WPARAM)hwndTop,
                                          MAKELONG( hittest, msg->message ) );
-- 
2.14.1




More information about the wine-patches mailing list