[PATCH] user32: Handle WM_SYSKEYDOWN in MENU_SuspendPopup.

Alex Henrie alexhenrie24 at gmail.com
Wed Nov 9 00:15:50 CST 2016


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 <alexhenrie24 at gmail.com>
---
 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




More information about the wine-patches mailing list