Vincent Povirk : user32: Allow EndMenu() calls from WM_ENTERMENULOOP.

Alexandre Julliard julliard at winehq.org
Fri Apr 18 11:01:04 CDT 2014


Module: wine
Branch: master
Commit: 68f2b878d27f9ea9065ad3b96f16fa408d8b85e6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=68f2b878d27f9ea9065ad3b96f16fa408d8b85e6

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Apr 16 12:56:09 2014 -0500

user32: Allow EndMenu() calls from WM_ENTERMENULOOP.

---

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

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index 4a49ce6..6b0cf2f 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -3015,7 +3015,6 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
     TRACE("hmenu=%p flags=0x%08x (%d,%d) hwnd=%p %s\n",
           hmenu, wFlags, x, y, hwnd, wine_dbgstr_rect( lprect));
 
-    fEndMenu = FALSE;
     if (!(menu = MENU_GetMenu( hmenu )))
     {
         WARN("Invalid menu handle %p\n", hmenu);
@@ -3306,12 +3305,20 @@ static BOOL MENU_InitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags)
 
     HideCaret(0);
 
+    if (!(menu = MENU_GetMenu( hMenu ))) return FALSE;
+
     /* This makes the menus of applications built with Delphi work.
      * It also enables menus to be displayed in more than one window,
      * but there are some bugs left that need to be fixed in this case.
      */
-    if (!bPopup && (menu = MENU_GetMenu( hMenu ))) menu->hWnd = hWnd;
-    if (!top_popup) top_popup_hmenu = hMenu;
+    if (!bPopup) menu->hWnd = hWnd;
+    if (!top_popup)
+    {
+        top_popup = menu->hWnd;
+        top_popup_hmenu = hMenu;
+    }
+
+    fEndMenu = FALSE;
 
     /* Send WM_ENTERMENULOOP and WM_INITMENU message only if TPM_NONOTIFY flag is not specified */
     if (!(wFlags & TPM_NONOTIFY))
diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c
index 5fbe317..dc91c6a 100644
--- a/dlls/user32/tests/menu.c
+++ b/dlls/user32/tests/menu.c
@@ -3324,17 +3324,11 @@ static void test_menu_cancelmode(void)
     /* menu owner is top level window */
     g_hwndtosend = hwnd;
     TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
-    todo_wine {
-        ok( g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
-    }
-    ok( g_got_enteridle < 2, "received %d WM_ENTERIDLE messages, should be less than 2\n", g_got_enteridle);
+    ok( g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
     /* menu owner is child window */
     g_hwndtosend = hwndchild;
     TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwndchild, NULL);
-    todo_wine {
-        ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
-    }
-    ok(g_got_enteridle < 2, "received %d WM_ENTERIDLE messages, should be less than 2\n", g_got_enteridle);
+    ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
     /* now send the WM_CANCELMODE messages to the WRONG window */
     /* those should fail ( to have any effect) */
     g_hwndtosend = hwnd;
@@ -3354,10 +3348,7 @@ static void test_menu_cancelmode(void)
     ok( ret == 0, "Sending WM_SYSCOMMAND/SC_KEYMENU failed lasterror is %u\n", GetLastError());
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
         DispatchMessageA(&msg);
-    todo_wine {
-        ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
-    }
-    ok(g_got_enteridle < 2, "received %d WM_ENTERIDLE messages, should be less than 2\n", g_got_enteridle);
+    ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
 
     /* cleanup */
     DestroyMenu( menubar );




More information about the wine-cvs mailing list