aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroga2008-07-22 20:26:12 +0000
committeroga2008-07-22 20:26:12 +0000
commitb4bfc6d32a6ba32f5ae79b7e8a9a010f9052ba8d (patch)
tree203c0ba2a55b5c368a8872588aa153c860da69dc
parent26f8b8b229d387b34881966becbae5b526818ee7 (diff)
downloadcwm-b4bfc6d32a6ba32f5ae79b7e8a9a010f9052ba8d.tar.gz
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 '')
-rw-r--r--calmwm.h3
-rw-r--r--xutil.c22
2 files changed, 20 insertions, 5 deletions
diff --git a/calmwm.h b/calmwm.h
index ba4fec0..a047301 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -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: calmwm.h,v 1.61 2008/07/22 19:54:57 oga Exp $
+ * $Id: calmwm.h,v 1.62 2008/07/22 20:26:12 oga Exp $
*/
#ifndef _CALMWM_H_
@@ -391,6 +391,7 @@ void xu_ptr_ungrab(void);
void xu_ptr_setpos(Window, int, int);
void xu_ptr_getpos(Window, int *, int *);
void xu_key_grab(Window, int, int);
+void xu_key_ungrab(Window, int, int);
void xu_sendmsg(struct client_ctx *, Atom, long);
int xu_getprop(struct client_ctx *, Atom, Atom, long,
u_char **);
diff --git a/xutil.c b/xutil.c
index f6553f1..a7ec1e9 100644
--- a/xutil.c
+++ b/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