]> code.delx.au - gnu-emacs/blobdiff - oldXMenu/Activate.c
In Postcript mode, C-c C-c launches Doc View minor mode for viewing
[gnu-emacs] / oldXMenu / Activate.c
index 363b225a3559fce6c2a7c3945626c03dffdabc08..4de752c8404f6b0b7572364e0b91cc057bd5f0c5 100644 (file)
@@ -2,6 +2,23 @@
 
 #include "copyright.h"
 
+/*
+Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+  Free Software Foundation, Inc.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
 /*
  * XMenu:      MIT Project Athena, X Window system menu package
  *
@@ -81,6 +98,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 +149,7 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
     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 +477,18 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
                }
                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.