diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2016-09-30 18:28:07 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2016-09-30 18:28:07 +0000 |
commit | 60d37dd205bccd3a790221848183df9419552329 (patch) | |
tree | 18607ef342517994d154d11b48a54ae135c9441f /app/cwm/xutil.c | |
parent | 9ec53fcd54ffc4870669648c13cba7e127240f8b (diff) |
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 'app/cwm/xutil.c')
-rw-r--r-- | app/cwm/xutil.c | 64 |
1 files changed, 1 insertions, 63 deletions
diff --git a/app/cwm/xutil.c b/app/cwm/xutil.c index 3e7e99eb1..f2691ff2c 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. * - * $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) { |