summary refs log tree commit diff
path: root/xutil.c
diff options
context:
space:
mode:
authoroga <oga>2008-07-22 20:26:12 +0000
committeroga <oga>2008-07-22 20:26:12 +0000
commit20052e024894b7cc2196c43076cfb441a57a99a6 (patch)
tree2ef5d448a24ec976cde1592809bd55447df1e1cf /xutil.c
parent13b640ea29cc07d725b25635617daeb1e8839dd3 (diff)
downloadcwm-20052e024894b7cc2196c43076cfb441a57a99a6.tar.gz
cwm-20052e024894b7cc2196c43076cfb441a57a99a6.tar.xz
cwm-20052e024894b7cc2196c43076cfb441a57a99a6.zip
Add xu_key_ungrab() and a mirror to xu_key_ungrab(). a couple of changes
that are coming up depend on it.

ok okan.
Diffstat (limited to 'xutil.c')
-rw-r--r--xutil.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/xutil.c b/xutil.c
index 2c6ad65..11cde2f 100644
--- a/xutil.c
+++ b/xutil.c
@@ -90,9 +90,23 @@ xu_key_grab(Window win, int mask, int keysym)
 		mask |= ShiftMask;
 
 	for (i = 0; i < sizeof(ign_mods)/sizeof(*ign_mods); i++)
-		XGrabKey(X_Dpy, XKeysymToKeycode(X_Dpy, keysym),
-		    (mask | ign_mods[i]), win, True, GrabModeAsync,
-		    GrabModeAsync);
+		XGrabKey(X_Dpy, code, (mask | ign_mods[i]), win,
+		    True, GrabModeAsync, GrabModeAsync);
+}
+
+void
+xu_key_ungrab(Window win, int mask, int keysym)
+{
+	KeyCode	 code;
+	int	 i;
+
+	code = XKeysymToKeycode(X_Dpy, keysym);
+	if ((XKeycodeToKeysym(X_Dpy, code, 0) != keysym) &&
+	    (XKeycodeToKeysym(X_Dpy, code, 1) == keysym))
+		mask |= ShiftMask;
+
+	for (i = 0; i < sizeof(ign_mods)/sizeof(*ign_mods); i++)
+		XUngrabKey(X_Dpy, code, (mask | ign_mods[i]), win);
 }
 
 void