Fix menu behaviour when escape is pressed.
This commit is contained in:
parent
7a0d4ba275
commit
18ce388db9
|
@ -2467,6 +2467,41 @@ static BOOL MENU_SuspendPopup( MTRACKER* pmt, UINT16 uMsg )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MENU_KeyEscape
|
||||
*
|
||||
* Handle a VK_ESCAPE key event in a menu.
|
||||
*/
|
||||
static BOOL MENU_KeyEscape(MTRACKER* pmt, UINT wFlags)
|
||||
{
|
||||
BOOL bEndMenu = TRUE;
|
||||
|
||||
if (pmt->hCurrentMenu != pmt->hTopMenu)
|
||||
{
|
||||
POPUPMENU *menu = MENU_GetMenu(pmt->hCurrentMenu);
|
||||
|
||||
if (menu->wFlags & MF_POPUP)
|
||||
{
|
||||
HMENU hmenutmp, hmenuprev;
|
||||
|
||||
hmenuprev = hmenutmp = pmt->hTopMenu;
|
||||
|
||||
/* close topmost popup */
|
||||
while (hmenutmp != pmt->hCurrentMenu)
|
||||
{
|
||||
hmenuprev = hmenutmp;
|
||||
hmenutmp = MENU_GetSubPopup( hmenuprev );
|
||||
}
|
||||
|
||||
MENU_HideSubPopups( pmt->hOwnerWnd, hmenuprev, TRUE );
|
||||
pmt->hCurrentMenu = hmenuprev;
|
||||
bEndMenu = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return bEndMenu;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* MENU_KeyLeft
|
||||
*
|
||||
|
@ -2747,7 +2782,7 @@ static INT MENU_TrackMenu( HMENU hmenu, UINT wFlags, INT x, INT y,
|
|||
break;
|
||||
|
||||
case VK_ESCAPE:
|
||||
fEndMenu = TRUE;
|
||||
fEndMenu = MENU_KeyEscape(&mt, wFlags);
|
||||
break;
|
||||
|
||||
case VK_F1:
|
||||
|
|
Loading…
Reference in New Issue