summaryrefslogtreecommitdiff
path: root/oldXMenu/Activate.c
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2002-04-22 18:27:03 +0000
committerJan Djärv <jan.h.d@swipnet.se>2002-04-22 18:27:03 +0000
commit38ee86a8f090961e9082c45134ef4c321bde9f90 (patch)
tree70d2eade3b04a5f09a260aa9ce26f1807259836f /oldXMenu/Activate.c
parent9b7e90fd17481a5471f344d2ddf8b0f102912e9a (diff)
downloademacs-38ee86a8f090961e9082c45134ef4c321bde9f90.tar.gz
Add calls to GrabKeyboard to remove strange
interactions with window managers that steal keypresses.
Diffstat (limited to 'oldXMenu/Activate.c')
-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 @@
-/* $Header: /gd/gnu/cvsroot/emacs/oldXMenu/Activate.c,v 1.2 2000/01/27 15:31:20 gerd Exp $ */
+/* $Header: /cvsroot/emacs//emacs/oldXMenu/Activate.c,v 1.3 2000/07/21 14:36:24 gerd Exp $ */
/* Copyright Massachusetts Institute of Technology 1985 */
#include "copyright.h"
@@ -83,6 +83,9 @@
#include <config.h>
#include "XMenuInt.h"
+/* For debug, set this to 0 to not grab the keyboard on menu popup */
+int x_menu_grab_keyboard = 1;
+
int
XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
help_callback)
@@ -225,6 +228,18 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
menu->mouse_cursor,
CurrentTime
);
+ if (status == Success && x_menu_grab_keyboard)
+ {
+ status = XGrabKeyboard (display,
+ menu->parent,
+ False,
+ GrabModeAsync,
+ GrabModeAsync,
+ CurrentTime);
+ if (status != Success)
+ XUngrabPointer(display, CurrentTime);
+ }
+
if (status == _X_FAILURE) {
_XMErrorCode = XME_GRAB_MOUSE;
return(XM_FAILURE);
@@ -465,6 +480,7 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data,
* Ungrab the mouse.
*/
XUngrabPointer(display, CurrentTime);
+ XUngrabKeyboard(display, CurrentTime);
/*
* Restore bits under where the menu was if we managed