Revert "user32: Set capture earlier on popup menus.".

This reverts commit a9bff001a1.

We can't set capture this early because the popup menu isn't visible
yet. To my knowledge, no applications depend on this, nor did the
next patch in the series. It's only a theoretical issue revealed by
a message test.

Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vincent Povirk 2016-04-19 12:57:47 -05:00 committed by Alexandre Julliard
parent 5f4c496480
commit 3cc6a1acc3
1 changed files with 4 additions and 9 deletions

View File

@ -3003,6 +3003,7 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
INT executedMenuId = -1; INT executedMenuId = -1;
MTRACKER mt; MTRACKER mt;
BOOL enterIdleSent = FALSE; BOOL enterIdleSent = FALSE;
HWND capture_win;
mt.trackFlags = 0; mt.trackFlags = 0;
mt.hCurrentMenu = hmenu; mt.hCurrentMenu = hmenu;
@ -3030,8 +3031,9 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
if (wFlags & TF_ENDMENU) fEndMenu = TRUE; if (wFlags & TF_ENDMENU) fEndMenu = TRUE;
if (!(wFlags & TPM_POPUPMENU)) /* owner may not be visible when tracking a popup, so use the menu itself */
set_capture_window( mt.hOwnerWnd, GUI_INMENUMODE, NULL ); capture_win = (wFlags & TPM_POPUPMENU) ? menu->hWnd : mt.hOwnerWnd;
set_capture_window( capture_win, GUI_INMENUMODE, NULL );
if ((wFlags & TPM_POPUPMENU) && menu->nItems == 0) if ((wFlags & TPM_POPUPMENU) && menu->nItems == 0)
return FALSE; return FALSE;
@ -3327,10 +3329,6 @@ static BOOL MENU_InitTracking(HWND hWnd, HMENU hMenu, BOOL bPopup, UINT wFlags)
SendMessageW( hWnd, WM_SETCURSOR, (WPARAM)hWnd, HTCAPTION ); SendMessageW( hWnd, WM_SETCURSOR, (WPARAM)hWnd, HTCAPTION );
if (bPopup)
/* owner may not be visible when tracking a popup, so use the menu itself */
set_capture_window( menu->hWnd, GUI_INMENUMODE, NULL );
if (!(wFlags & TPM_NONOTIFY)) if (!(wFlags & TPM_NONOTIFY))
{ {
SendMessageW( hWnd, WM_INITMENU, (WPARAM)hMenu, 0 ); SendMessageW( hWnd, WM_INITMENU, (WPARAM)hMenu, 0 );
@ -3484,9 +3482,6 @@ BOOL WINAPI TrackPopupMenuEx( HMENU hMenu, UINT wFlags, INT x, INT y,
if (MENU_ShowPopup( hWnd, hMenu, 0, wFlags, x, y, 0, 0 )) if (MENU_ShowPopup( hWnd, hMenu, 0, wFlags, x, y, 0, 0 ))
ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd, ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd,
lpTpm ? &lpTpm->rcExclude : NULL ); lpTpm ? &lpTpm->rcExclude : NULL );
set_capture_window( 0, GUI_INMENUMODE, NULL );
MENU_ExitTracking(hWnd, TRUE); MENU_ExitTracking(hWnd, TRUE);
if (menu->hWnd) if (menu->hWnd)