[4/5] user32: Set capture earlier on popup menus.

Vincent Povirk madewokherd at gmail.com
Tue Jun 24 14:56:19 CDT 2014


-------------- next part --------------
From 670c3a2aee0507ba0103181296e02aacd705cff5 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 25 Mar 2014 16:36:48 -0500
Subject: [PATCH 4/5] user32: Set capture earlier on popup menus.

---
 dlls/user32/menu.c      | 13 +++++++++++--
 dlls/user32/tests/msg.c |  2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 3179a32..b9c1508 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -3025,8 +3025,11 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
 
     if (wFlags & TF_ENDMENU) fEndMenu = TRUE;
 
-    capture_win = mt.hOwnerWnd;
-    set_capture_window( capture_win, GUI_INMENUMODE, NULL );
+    if (!(wFlags & TPM_POPUPMENU))
+    {
+        capture_win = mt.hOwnerWnd;
+        set_capture_window( capture_win, GUI_INMENUMODE, NULL );
+    }
 
     __TRY while (!fEndMenu)
     {
@@ -3319,6 +3322,9 @@ static BOOL MENU_InitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags)
 
     SendMessageW( hWnd, WM_SETCURSOR, (WPARAM)hWnd, HTCAPTION );
 
+    if (bPopup)
+        set_capture_window( hWnd, GUI_INMENUMODE, NULL );
+
     if (!(wFlags & TPM_NONOTIFY))
     {
        SendMessageW( hWnd, WM_INITMENU, (WPARAM)hMenu, 0 );
@@ -3472,6 +3478,9 @@ BOOL WINAPI TrackPopupMenuEx( HMENU hMenu, UINT wFlags, INT x, INT y,
         if (MENU_ShowPopup( hWnd, hMenu, 0, wFlags, x, y, 0, 0 ))
             ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd,
                                   lpTpm ? &lpTpm->rcExclude : NULL );
+
+        set_capture_window( 0, GUI_INMENUMODE, NULL );
+
         MENU_ExitTracking(hWnd, TRUE);
 
         if (menu->hWnd)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 841c5da..0da2731 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -14437,7 +14437,7 @@ static void test_TrackPopupMenu(void)
     flush_events();
     flush_sequence();
     ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
-    ok_sequence(WmTrackPopupMenuCapture, "TrackPopupMenuCapture", TRUE);
+    ok_sequence(WmTrackPopupMenuCapture, "TrackPopupMenuCapture", FALSE);
     ok(ret == 1, "TrackPopupMenuCapture failed with error %i\n", GetLastError());
 
     DestroyMenu(hpopupmenu);
-- 
1.8.3.2



More information about the wine-patches mailing list