controls/menu.c

Ulrich Czekalla ulrich.czekalla at utoronto.ca
Fri May 18 13:53:48 CDT 2001


Currently if a menu is opened and escape is pressed we exit the menu loop.
Under Windows, only the submenu is closed. This allows us to hit escape
once and still moving along the menubar. Hit escape again and we exit the
menu loop.

ChangeLog:
    * controls/menu.c
    Ulrich Czekalla <uczekalla at codeweavers.com>
    Fix menu behaviour when escape is pressed
-------------- next part --------------
Index: controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.116
diff -u -w -r1.116 menu.c
--- controls/menu.c	2001/05/14 19:20:13	1.116
+++ controls/menu.c	2001/05/18 18:47:50
@@ -2468,6 +2468,41 @@
 }
 
 /***********************************************************************
+ *           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
  *
  * Handle a VK_LEFT key event in a menu. 
@@ -2747,7 +2782,7 @@
 		    break;
 		    
 		case VK_ESCAPE:
-		    fEndMenu = TRUE;
+	    	fEndMenu = MENU_KeyEscape(&mt, wFlags);
 		    break;
 
 		case VK_F1:


More information about the wine-patches mailing list