user32: Skip menu loop for empty popup menus.

Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vincent Povirk 2016-03-14 16:13:57 -05:00 committed by Alexandre Julliard
parent a9bff001a1
commit 906db769f1
3 changed files with 11 additions and 8 deletions

View File

@ -3033,6 +3033,9 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
if (!(wFlags & TPM_POPUPMENU)) if (!(wFlags & TPM_POPUPMENU))
set_capture_window( mt.hOwnerWnd, GUI_INMENUMODE, NULL ); set_capture_window( mt.hOwnerWnd, GUI_INMENUMODE, NULL );
if ((wFlags & TPM_POPUPMENU) && menu->nItems == 0)
return FALSE;
__TRY while (!fEndMenu) __TRY while (!fEndMenu)
{ {
menu = MENU_GetMenu( mt.hCurrentMenu ); menu = MENU_GetMenu( mt.hCurrentMenu );

View File

@ -3820,25 +3820,25 @@ static void test_emptypopup(void)
ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup); ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup);
ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop); ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop);
ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu); ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu);
todo_wine ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu); ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu);
todo_wine ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp); ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp);
todo_wine ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp); ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp);
gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0; gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0;
selectitem_wp = 0xdeadbeef; selectitem_wp = 0xdeadbeef;
selectitem_lp = 0xdeadbeef; selectitem_lp = 0xdeadbeef;
ret = TrackPopupMenu( hmenu, 0, 100,100, 0, hwnd, NULL); ret = TrackPopupMenu( hmenu, 0, 100,100, 0, hwnd, NULL);
todo_wine ok(ret == 0, "got %i\n", ret); ok(ret == 0, "got %i\n", ret);
ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup); ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup);
ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop); ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop);
ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu); ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu);
todo_wine ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu); ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu);
todo_wine ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp); ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp);
todo_wine ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp); ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp);
SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_fill_in_init); SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_fill_in_init);

View File

@ -15373,7 +15373,7 @@ static void test_TrackPopupMenuEmpty(void)
flush_sequence(); flush_sequence();
ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL); ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
ok_sequence(WmTrackPopupMenuEmpty, "TrackPopupMenuEmpty", TRUE); ok_sequence(WmTrackPopupMenuEmpty, "TrackPopupMenuEmpty", TRUE);
todo_wine ok(ret == 0, "TrackPopupMenu succeeded\n"); ok(ret == 0, "TrackPopupMenu succeeded\n");
DestroyMenu(hpopupmenu); DestroyMenu(hpopupmenu);
DestroyWindow(hwnd); DestroyWindow(hwnd);