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 /xutil.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-- | xutil.c | 64 |
1 files changed, 1 insertions, 63 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: xutil.c,v 1.105 2016/09/28 17:06:33 okan Exp $ + * $OpenBSD: xutil.c,v 1.106 2016/09/30 18:28:06 okan Exp $ */ #include <sys/types.h> @@ -31,68 +31,6 @@ #include "calmwm.h" -static unsigned int ign_mods[] = { 0, LockMask, Mod2Mask, Mod2Mask | LockMask }; - -void -xu_btn_grab(Window win, int mask, unsigned int btn) -{ - unsigned int i; - - for (i = 0; i < nitems(ign_mods); i++) - XGrabButton(X_Dpy, btn, (mask | ign_mods[i]), win, - False, BUTTONMASK, GrabModeAsync, - GrabModeSync, None, None); -} - -void -xu_btn_ungrab(Window win) -{ - XUngrabButton(X_Dpy, AnyButton, AnyModifier, win); -} - -void -xu_key_grab(Window win, unsigned int mask, KeySym keysym) -{ - KeyCode code; - unsigned int i; - - code = XKeysymToKeycode(X_Dpy, keysym); - if ((XkbKeycodeToKeysym(X_Dpy, code, 0, 0) != keysym) && - (XkbKeycodeToKeysym(X_Dpy, code, 0, 1) == keysym)) - mask |= ShiftMask; - - for (i = 0; i < nitems(ign_mods); i++) - XGrabKey(X_Dpy, code, (mask | ign_mods[i]), win, - True, GrabModeAsync, GrabModeAsync); -} - -void -xu_key_ungrab(Window win) -{ - XUngrabKey(X_Dpy, AnyKey, AnyModifier, win); -} - -int -xu_ptr_grab(Window win, unsigned int mask, Cursor curs) -{ - return(XGrabPointer(X_Dpy, win, False, mask, - GrabModeAsync, GrabModeAsync, - None, curs, CurrentTime) == GrabSuccess ? 0 : -1); -} - -int -xu_ptr_regrab(unsigned int mask, Cursor curs) -{ - return(XChangeActivePointerGrab(X_Dpy, mask, - curs, CurrentTime) == GrabSuccess ? 0 : -1); -} - -void -xu_ptr_ungrab(void) -{ - XUngrabPointer(X_Dpy, CurrentTime); -} - void xu_ptr_getpos(Window win, int *x, int *y) { |