summaryrefslogtreecommitdiff
path: root/app/cwm/conf.c
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2016-09-30 18:28:07 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2016-09-30 18:28:07 +0000
commit60d37dd205bccd3a790221848183df9419552329 (patch)
tree18607ef342517994d154d11b48a54ae135c9441f /app/cwm/conf.c
parent9ec53fcd54ffc4870669648c13cba7e127240f8b (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/conf.c')
-rw-r--r--app/cwm/conf.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/app/cwm/conf.c b/app/cwm/conf.c
index 5791db461..374532615 100644
--- a/app/cwm/conf.c
+++ b/app/cwm/conf.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: 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[] = {