Commit 68f2b878 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

user32: Allow EndMenu() calls from WM_ENTERMENULOOP.

parent 09721aca
...@@ -3015,7 +3015,6 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y, ...@@ -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", TRACE("hmenu=%p flags=0x%08x (%d,%d) hwnd=%p %s\n",
hmenu, wFlags, x, y, hwnd, wine_dbgstr_rect( lprect)); hmenu, wFlags, x, y, hwnd, wine_dbgstr_rect( lprect));
fEndMenu = FALSE;
if (!(menu = MENU_GetMenu( hmenu ))) if (!(menu = MENU_GetMenu( hmenu )))
{ {
WARN("Invalid menu handle %p\n", hmenu); WARN("Invalid menu handle %p\n", hmenu);
...@@ -3306,12 +3305,20 @@ static BOOL MENU_InitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags) ...@@ -3306,12 +3305,20 @@ static BOOL MENU_InitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags)
HideCaret(0); HideCaret(0);
if (!(menu = MENU_GetMenu( hMenu ))) return FALSE;
/* This makes the menus of applications built with Delphi work. /* This makes the menus of applications built with Delphi work.
* It also enables menus to be displayed in more than one window, * 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. * but there are some bugs left that need to be fixed in this case.
*/ */
if (!bPopup && (menu = MENU_GetMenu( hMenu ))) menu->hWnd = hWnd; if (!bPopup) menu->hWnd = hWnd;
if (!top_popup) top_popup_hmenu = hMenu; 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 */ /* Send WM_ENTERMENULOOP and WM_INITMENU message only if TPM_NONOTIFY flag is not specified */
if (!(wFlags & TPM_NONOTIFY)) if (!(wFlags & TPM_NONOTIFY))
......
...@@ -3324,17 +3324,11 @@ static void test_menu_cancelmode(void) ...@@ -3324,17 +3324,11 @@ static void test_menu_cancelmode(void)
/* menu owner is top level window */ /* menu owner is top level window */
g_hwndtosend = hwnd; g_hwndtosend = hwnd;
TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL); 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 == 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);
/* menu owner is child window */ /* menu owner is child window */
g_hwndtosend = hwndchild; g_hwndtosend = hwndchild;
TrackPopupMenu( menu, TPM_RETURNCMD, 100,100, 0, hwndchild, NULL); 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 == 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);
/* now send the WM_CANCELMODE messages to the WRONG window */ /* now send the WM_CANCELMODE messages to the WRONG window */
/* those should fail ( to have any effect) */ /* those should fail ( to have any effect) */
g_hwndtosend = hwnd; g_hwndtosend = hwnd;
...@@ -3354,10 +3348,7 @@ static void test_menu_cancelmode(void) ...@@ -3354,10 +3348,7 @@ static void test_menu_cancelmode(void)
ok( ret == 0, "Sending WM_SYSCOMMAND/SC_KEYMENU failed lasterror is %u\n", GetLastError()); ok( ret == 0, "Sending WM_SYSCOMMAND/SC_KEYMENU failed lasterror is %u\n", GetLastError());
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
DispatchMessageA(&msg); DispatchMessageA(&msg);
todo_wine { ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
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);
/* cleanup */ /* cleanup */
DestroyMenu( menubar ); DestroyMenu( menubar );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment