From 3c9ef4366fd228c7272aa4f467ee4f7ecadf2049 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 30 Sep 2016 18:28:06 +0000 Subject: 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. --- xutil.c | 64 +--------------------------------------------------------------- 1 file changed, 1 insertion(+), 63 deletions(-) (limited to 'xutil.c') diff --git a/xutil.c b/xutil.c index 3e7e99e..f2691ff 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. * - * $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 @@ -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) { -- cgit v1.2.3-2-gb3c3