From: Alex Henrie Subject: [PATCH] user32: Handle WM_SYSKEYDOWN in MENU_SuspendPopup. Message-Id: <20161109061550.15486-1-alexhenrie24@gmail.com> Date: Tue, 8 Nov 2016 23:15:50 -0700 Technically, all the stuff about WM_SYSKEYDOWN is unnecessary. All we really need to do is fix the error handling, or remove this questionable optimization altogether. Signed-off-by: Alex Henrie --- dlls/user32/menu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 45ce7f5..83058fb 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -2806,24 +2806,26 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk, UINT wFlags ) * The idea is not to show the popup if the next input message is * going to hide it anyway. */ -static BOOL MENU_SuspendPopup( MTRACKER* pmt, UINT16 uMsg ) +static BOOL MENU_SuspendPopup( MTRACKER* pmt ) { MSG msg; msg.hwnd = pmt->hOwnerWnd; - PeekMessageW( &msg, 0, uMsg, uMsg, PM_NOYIELD | PM_REMOVE); + PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE); pmt->trackFlags |= TF_SKIPREMOVE; - switch( uMsg ) + switch( msg.message ) { case WM_KEYDOWN: + case WM_SYSKEYDOWN: + PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_REMOVE); PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE); - if( msg.message == WM_KEYUP || msg.message == WM_PAINT ) + if( msg.message == WM_KEYUP || msg.message == WM_SYSKEYUP || msg.message == WM_PAINT ) { PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_REMOVE); PeekMessageW( &msg, 0, 0, 0, PM_NOYIELD | PM_NOREMOVE); - if( msg.message == WM_KEYDOWN && + if( (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) && (msg.wParam == VK_LEFT || msg.wParam == VK_RIGHT)) { pmt->trackFlags |= TF_SUSPENDPOPUP; @@ -2918,7 +2920,7 @@ static void MENU_KeyLeft( MTRACKER* pmt, UINT wFlags ) /* A sublevel menu was displayed - display the next one * unless there is another displacement coming up */ - if( !MENU_SuspendPopup( pmt, WM_KEYDOWN ) ) + if( !MENU_SuspendPopup( pmt ) ) pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, pmt->hTopMenu, TRUE, wFlags); } @@ -2975,7 +2977,7 @@ static void MENU_KeyRight( MTRACKER* pmt, UINT wFlags ) MENU_MoveSelection( pmt->hOwnerWnd, pmt->hTopMenu, ITEM_NEXT ); if( hmenutmp || pmt->trackFlags & TF_SUSPENDPOPUP ) - if( !MENU_SuspendPopup(pmt, WM_KEYDOWN) ) + if( !MENU_SuspendPopup( pmt ) ) pmt->hCurrentMenu = MENU_ShowSubPopup(pmt->hOwnerWnd, pmt->hTopMenu, TRUE, wFlags); } -- 2.10.2