summary refs log tree commit diff
path: root/menu.c
diff options
context:
space:
mode:
authoroga <oga>2008-05-23 18:48:57 +0000
committeroga <oga>2008-05-23 18:48:57 +0000
commit48528d9ba1b2b2fb1b0a46d772d280827018a246 (patch)
tree67a19c8cb79e29f78146f8a3e0376948106292b3 /menu.c
parent779cf04f0557baa2f94ab788e0a1c36cd3a613c5 (diff)
downloadcwm-48528d9ba1b2b2fb1b0a46d772d280827018a246.tar.gz
cwm-48528d9ba1b2b2fb1b0a46d772d280827018a246.tar.xz
cwm-48528d9ba1b2b2fb1b0a46d772d280827018a246.zip
Grab the keyboard when we initialise the menu. This stops the keyboard
shortcut code stealing our events in some cases.

"put 'er in" okan@.
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/menu.c b/menu.c
index b3a77cf..a98ad58 100644
--- a/menu.c
+++ b/menu.c
@@ -118,6 +118,10 @@ menu_filter(struct menu_q *menuq, char *prompt, char *initial, int dummy,
 	XGetInputFocus(X_Dpy, &focuswin, &focusrevert);
 	XSetInputFocus(X_Dpy, sc->menuwin, RevertToPointerRoot, CurrentTime);
 
+	/* make sure keybindings don't remove keys from the menu stream */
+	XGrabKeyboard(X_Dpy, sc->menuwin, True,
+	    GrabModeAsync, GrabModeAsync, CurrentTime);
+
 	for (;;) {
 		mc.changed = 0;
 
@@ -153,6 +157,7 @@ out:
 	}
 
 	XUnmapWindow(X_Dpy, sc->menuwin);
+	XUngrabKeyboard(X_Dpy, CurrentTime);
 
 	return (mi);
 }