aboutsummaryrefslogtreecommitdiffstats
path: root/xevents.c
diff options
context:
space:
mode:
authorokan2012-05-16 01:09:17 +0000
committerokan2012-05-16 01:09:17 +0000
commit0d42809e06455c0a8cd1f170f15e81c812e7ef61 (patch)
tree0e24de841f00362538546f9550c56edd3d006672 /xevents.c
parentec7333262c7838cbfe2490d704f53de385dbace2 (diff)
downloadcwm-0d42809e06455c0a8cd1f170f15e81c812e7ef61.tar.gz
cycle through other common cycling modifiers; based on a diff from
Alexander Polakov. ok sthen@
Diffstat (limited to 'xevents.c')
-rw-r--r--xevents.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/xevents.c b/xevents.c
index 23cb4a6..93b4b13 100644
--- a/xevents.c
+++ b/xevents.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: xevents.c,v 1.58 2012/05/16 01:04:36 okan Exp $
+ * $OpenBSD: xevents.c,v 1.59 2012/05/16 01:09:17 okan Exp $
*/
/*
@@ -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;
+ }
}
}