aboutsummaryrefslogtreecommitdiffstats
path: root/oldXMenu
diff options
context:
space:
mode:
authorJan Djärv2002-04-22 18:27:03 +0000
committerJan Djärv2002-04-22 18:27:03 +0000
commit38ee86a8f090961e9082c45134ef4c321bde9f90 (patch)
tree70d2eade3b04a5f09a260aa9ce26f1807259836f /oldXMenu
parent9b7e90fd17481a5471f344d2ddf8b0f102912e9a (diff)
downloademacs-38ee86a8f090961e9082c45134ef4c321bde9f90.tar.gz
emacs-38ee86a8f090961e9082c45134ef4c321bde9f90.zip
Add calls to GrabKeyboard to remove strange
interactions with window managers that steal keypresses.
Diffstat (limited to 'oldXMenu')
-rw-r--r--oldXMenu/Activate.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c
index 2c36cc85033..5196d0ccc12 100644
--- a/oldXMenu/Activate.c
+++ b/oldXMenu/Activate.c
@@ -1,4 +1,4 @@
1/* $Header: /gd/gnu/cvsroot/emacs/oldXMenu/Activate.c,v 1.2 2000/01/27 15:31:20 gerd Exp $ */ 1/* $Header: /cvsroot/emacs//emacs/oldXMenu/Activate.c,v 1.3 2000/07/21 14:36:24 gerd Exp $ */
2/* Copyright Massachusetts Institute of Technology 1985 */ 2/* Copyright Massachusetts Institute of Technology 1985 */
3 3
4#include "copyright.h" 4#include "copyright.h"
@@ -83,6 +83,9 @@
83#include <config.h> 83#include <config.h>
84#include "XMenuInt.h" 84#include "XMenuInt.h"
85 85
86/* For debug, set this to 0 to not grab the keyboard on menu popup */
87int x_menu_grab_keyboard = 1;
88
86int 89int
87XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data, 90XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
88 help_callback) 91 help_callback)
@@ -225,6 +228,18 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
225 menu->mouse_cursor, 228 menu->mouse_cursor,
226 CurrentTime 229 CurrentTime
227 ); 230 );
231 if (status == Success && x_menu_grab_keyboard)
232 {
233 status = XGrabKeyboard (display,
234 menu->parent,
235 False,
236 GrabModeAsync,
237 GrabModeAsync,
238 CurrentTime);
239 if (status != Success)
240 XUngrabPointer(display, CurrentTime);
241 }
242
228 if (status == _X_FAILURE) { 243 if (status == _X_FAILURE) {
229 _XMErrorCode = XME_GRAB_MOUSE; 244 _XMErrorCode = XME_GRAB_MOUSE;
230 return(XM_FAILURE); 245 return(XM_FAILURE);
@@ -465,6 +480,7 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
465 * Ungrab the mouse. 480 * Ungrab the mouse.
466 */ 481 */
467 XUngrabPointer(display, CurrentTime); 482 XUngrabPointer(display, CurrentTime);
483 XUngrabKeyboard(display, CurrentTime);
468 484
469 /* 485 /*
470 * Restore bits under where the menu was if we managed 486 * Restore bits under where the menu was if we managed