changeset 59101:8aef5660523e

* Activate.c (XMenuActivate): Return XM_NO_SELECT if Escape or C-g was pressed.
author Jan Djärv <jan.h.d@swipnet.se>
date Mon, 27 Dec 2004 15:23:22 +0000
parents 768cf68dcd0a
children 0096c58ce34a
files oldXMenu/Activate.c oldXMenu/ChangeLog
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/oldXMenu/Activate.c	Mon Dec 27 15:22:36 2004 +0000
+++ b/oldXMenu/Activate.c	Mon Dec 27 15:23:22 2004 +0000
@@ -81,6 +81,7 @@
 
 #include <config.h>
 #include "XMenuInt.h"
+#include <X11/keysym.h>
 
 /* For debug, set this to 0 to not grab the keyboard on menu popup */
 int x_menu_grab_keyboard = 1;
@@ -131,6 +132,7 @@
     Window root, child;
     int root_x, root_y, win_x, win_y;
     unsigned int mask;
+    KeySym keysym;
 
     /*
      * Define and allocate a foreign event queue to hold events
@@ -458,6 +460,18 @@
 		}
 		selection = True;
 		break;
+        case KeyPress:
+        case KeyRelease:
+                keysym = XLookupKeysym (&event.xkey, 0);
+
+                /* Pop down on C-g and Escape.  */
+                if ((keysym == XK_g && (event.xkey.state & ControlMask) != 0)
+                    || keysym == XK_Escape) /* Any escape, ignore modifiers.  */
+                  {
+                    ret_val = XM_NO_SELECT;
+                    selection = True;
+                  }
+               break;
 	    default:
 		/*
 		 * If AEQ mode is enabled then queue the event.
--- a/oldXMenu/ChangeLog	Mon Dec 27 15:22:36 2004 +0000
+++ b/oldXMenu/ChangeLog	Mon Dec 27 15:23:22 2004 +0000
@@ -1,3 +1,8 @@
+2004-12-27  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* Activate.c (XMenuActivate): Return XM_NO_SELECT if Escape or C-g
+	was pressed.
+
 2004-11-12  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* XMenu.h (XMenuActivateSetWaitFunction): New function.