diff options
author | okan | 2016-09-30 18:28:06 +0000 |
---|---|---|
committer | okan | 2016-09-30 18:28:06 +0000 |
commit | 3c9ef4366fd228c7272aa4f467ee4f7ecadf2049 (patch) | |
tree | 9156fb5949d06e6243f4fd6a92a55c24aa923090 /conf.c | |
parent | 6683b9c99889c3bbc28f721777801aef4ba84bf9 (diff) | |
download | cwm-3c9ef4366fd228c7272aa4f467ee4f7ecadf2049.tar.gz |
Use instinsic X11 functions for key/btn/ptr grab/ungrab/regrab requests;
the one line wrappers provided no value and limited altering calls where
needed; additionally, most of them had but one caller.
Diffstat (limited to '')
-rw-r--r-- | conf.c | 34 |
1 files changed, 27 insertions, 7 deletions
@@ -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. * - * $OpenBSD: conf.c,v 1.207 2016/09/29 00:21:55 okan Exp $ + * $OpenBSD: conf.c,v 1.208 2016/09/30 18:28:06 okan Exp $ */ #include <sys/types.h> @@ -655,28 +655,48 @@ conf_cursor(struct conf *c) c->cursor[i] = XCreateFontCursor(X_Dpy, cursor_binds[i]); } +static unsigned int ign_mods[] = { 0, LockMask, Mod2Mask, Mod2Mask | LockMask }; + void conf_grab_mouse(Window win) { struct binding *mb; + unsigned int i; - xu_btn_ungrab(win); + XUngrabButton(X_Dpy, AnyButton, AnyModifier, win); TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) { - if (mb->context == CWM_CONTEXT_CLIENT) - xu_btn_grab(win, mb->modmask, mb->press.button); + if (mb->context != CWM_CONTEXT_CLIENT) + continue; + for (i = 0; i < nitems(ign_mods); i++) { + XGrabButton(X_Dpy, mb->press.button, + (mb->modmask | ign_mods[i]), win, False, + BUTTONMASK, GrabModeAsync, GrabModeSync, + None, None); + } } + } void conf_grab_kbd(Window win) { struct binding *kb; + KeyCode kc; + unsigned int i; - xu_key_ungrab(win); + XUngrabKey(X_Dpy, AnyKey, AnyModifier, win); - TAILQ_FOREACH(kb, &Conf.keybindingq, entry) - xu_key_grab(win, kb->modmask, kb->press.keysym); + TAILQ_FOREACH(kb, &Conf.keybindingq, entry) { + kc = XKeysymToKeycode(X_Dpy, kb->press.keysym); + if ((XkbKeycodeToKeysym(X_Dpy, kc, 0, 0) != kb->press.keysym) && + (XkbKeycodeToKeysym(X_Dpy, kc, 0, 1) == kb->press.keysym)) + kb->modmask |= ShiftMask; + + for (i = 0; i < nitems(ign_mods); i++) + XGrabKey(X_Dpy, kc, (kb->modmask | ign_mods[i]), win, + True, GrabModeAsync, GrabModeAsync); + } } static char *cwmhints[] = { |