comparison oldXMenu/Activate.c @ 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 9351060ba546
children 3861ff8f4bf1 223c12363c0c 95879cc1ed20
comparison
equal deleted inserted replaced
59100:768cf68dcd0a 59101:8aef5660523e
79 * 79 *
80 */ 80 */
81 81
82 #include <config.h> 82 #include <config.h>
83 #include "XMenuInt.h" 83 #include "XMenuInt.h"
84 #include <X11/keysym.h>
84 85
85 /* For debug, set this to 0 to not grab the keyboard on menu popup */ 86 /* For debug, set this to 0 to not grab the keyboard on menu popup */
86 int x_menu_grab_keyboard = 1; 87 int x_menu_grab_keyboard = 1;
87 88
88 typedef void (*Wait_func)(); 89 typedef void (*Wait_func)();
129 Bool forward = True; /* Moving forward in the pane list. */ 130 Bool forward = True; /* Moving forward in the pane list. */
130 131
131 Window root, child; 132 Window root, child;
132 int root_x, root_y, win_x, win_y; 133 int root_x, root_y, win_x, win_y;
133 unsigned int mask; 134 unsigned int mask;
135 KeySym keysym;
134 136
135 /* 137 /*
136 * Define and allocate a foreign event queue to hold events 138 * Define and allocate a foreign event queue to hold events
137 * that don't belong to XMenu. These events are later restored 139 * that don't belong to XMenu. These events are later restored
138 * to the X event queue. 140 * to the X event queue.
456 */ 458 */
457 ret_val = XM_NO_SELECT; 459 ret_val = XM_NO_SELECT;
458 } 460 }
459 selection = True; 461 selection = True;
460 break; 462 break;
463 case KeyPress:
464 case KeyRelease:
465 keysym = XLookupKeysym (&event.xkey, 0);
466
467 /* Pop down on C-g and Escape. */
468 if ((keysym == XK_g && (event.xkey.state & ControlMask) != 0)
469 || keysym == XK_Escape) /* Any escape, ignore modifiers. */
470 {
471 ret_val = XM_NO_SELECT;
472 selection = True;
473 }
474 break;
461 default: 475 default:
462 /* 476 /*
463 * If AEQ mode is enabled then queue the event. 477 * If AEQ mode is enabled then queue the event.
464 */ 478 */
465 if (menu->aeq) { 479 if (menu->aeq) {