summaryrefslogtreecommitdiff
path: root/app/cwm/xutil.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-07-22 20:26:13 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-07-22 20:26:13 +0000
commitb81f30ea5d81586920c59ae605718569260159e0 (patch)
tree5100374df7447e093e3dd0595a2a89c9c4f2d6a4 /app/cwm/xutil.c
parent8fd6421b148a616b28a03a91d1f2d8e6397fc555 (diff)
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 'app/cwm/xutil.c')
-rw-r--r--app/cwm/xutil.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/app/cwm/xutil.c b/app/cwm/xutil.c
index f6553f155..a7ec1e967 100644
--- a/app/cwm/xutil.c
+++ b/app/cwm/xutil.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: xutil.c,v 1.8 2008/07/11 14:21:28 okan Exp $
+ * $Id: xutil.c,v 1.9 2008/07/22 20:26:12 oga Exp $
*/
#include "headers.h"
@@ -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