diff options
author | okan <okan> | 2012-05-16 01:09:17 +0000 |
---|---|---|
committer | okan <okan> | 2012-05-16 01:09:17 +0000 |
commit | ac82403a5166ac99aaf8fc7ad15242b1a0843f5b (patch) | |
tree | f3ddaf9ecbd66753ec4096be3e827a0d55fce778 | |
parent | dd5bfdb064470cfa2555003a13a70b8fa7cd6431 (diff) | |
download | cwm-ac82403a5166ac99aaf8fc7ad15242b1a0843f5b.tar.gz cwm-ac82403a5166ac99aaf8fc7ad15242b1a0843f5b.tar.xz cwm-ac82403a5166ac99aaf8fc7ad15242b1a0843f5b.zip |
cycle through other common cycling modifiers; based on a diff from
Alexander Polakov. ok sthen@
-rw-r--r-- | calmwm.h | 1 | ||||
-rw-r--r-- | client.c | 12 | ||||
-rw-r--r-- | xevents.c | 26 |
3 files changed, 23 insertions, 16 deletions
diff --git a/calmwm.h b/calmwm.h index 85141bb..95dceda 100644 --- a/calmwm.h +++ b/calmwm.h @@ -307,6 +307,7 @@ __dead void usage(void); void client_applysizehints(struct client_ctx *); struct client_ctx *client_current(void); void client_cycle(struct screen_ctx *, int); +void client_cycle_leave(struct screen_ctx *, struct client_ctx *); void client_delete(struct client_ctx *); void client_draw_border(struct client_ctx *); struct client_ctx *client_find(Window); diff --git a/client.c b/client.c index 713ee1d..5fe7aaf 100644 --- a/client.c +++ b/client.c @@ -644,6 +644,18 @@ client_cycle(struct screen_ctx *sc, int flags) client_ptrwarp(newcc); } +void +client_cycle_leave(struct screen_ctx *sc, struct client_ctx *cc) +{ + sc->cycling = 0; + + client_mtf(NULL); + if (cc) { + group_sticky_toggle_exit(cc); + XUngrabKeyboard(X_Dpy, CurrentTime); + } +} + static struct client_ctx * client_mrunext(struct client_ctx *cc) { diff --git a/xevents.c b/xevents.c index 14c8f2d..90304c4 100644 --- a/xevents.c +++ b/xevents.c @@ -70,6 +70,9 @@ void (*xev_handlers[LASTEvent])(XEvent *) = { [MappingNotify] = xev_handle_mappingnotify, }; +static KeySym modkeys[] = { XK_Alt_L, XK_Alt_R, XK_Super_L, XK_Super_R, + XK_Control_L, XK_Control_R }; + static void xev_handle_maprequest(XEvent *ee) { @@ -314,7 +317,7 @@ xev_handle_keypress(XEvent *ee) } /* - * This is only used for the alt suppression detection. + * This is only used for the modifier suppression detection. */ static void xev_handle_keyrelease(XEvent *ee) @@ -322,26 +325,17 @@ xev_handle_keyrelease(XEvent *ee) XKeyEvent *e = &ee->xkey; struct screen_ctx *sc; struct client_ctx *cc; - int keysym; + int i, keysym; sc = screen_fromroot(e->root); cc = client_current(); keysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 0); - if (keysym != XK_Alt_L && keysym != XK_Alt_R) - return; - - sc->cycling = 0; - - /* - * XXX - better interface... xevents should not know about - * how/when to mtf. - */ - client_mtf(NULL); - - if (cc != NULL) { - group_sticky_toggle_exit(cc); - XUngrabKeyboard(X_Dpy, CurrentTime); + for (i = 0; i < nitems(modkeys); i++) { + if (keysym == modkeys[i]) { + client_cycle_leave(sc, cc); + break; + } } } |