diff options
author | okan <okan> | 2013-07-10 14:15:58 +0000 |
---|---|---|
committer | okan <okan> | 2013-07-10 14:15:58 +0000 |
commit | bd7b8163bb0be2bd4904a179771a8f79163e8161 (patch) | |
tree | 80b60f037fa949a3a50d0dd42b19e38c318d76bf | |
parent | 95710383580ecf66a58f27ecaa62dfe6c714c682 (diff) | |
download | cwm-bd7b8163bb0be2bd4904a179771a8f79163e8161.tar.gz cwm-bd7b8163bb0be2bd4904a179771a8f79163e8161.tar.xz cwm-bd7b8163bb0be2bd4904a179771a8f79163e8161.zip |
bring buttonpress and keypress event handlers slightly closer together
-rw-r--r-- | xevents.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/xevents.c b/xevents.c index 4d31e65..16bd10e 100644 --- a/xevents.c +++ b/xevents.c @@ -238,12 +238,8 @@ xev_handle_buttonpress(XEvent *ee) { XButtonEvent *e = &ee->xbutton; struct client_ctx *cc, fakecc; - struct screen_ctx *sc; struct mousebinding *mb; - sc = screen_fromroot(e->root); - cc = client_find(e->window); - e->state &= ~IGNOREMODMASK; TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) { @@ -253,13 +249,16 @@ xev_handle_buttonpress(XEvent *ee) if (mb == NULL) return; - if (mb->flags == MOUSEBIND_CTX_ROOT) { - if (e->window != sc->rootwin) + if (mb->flags == MOUSEBIND_CTX_WIN) { + if (((cc = client_find(e->window)) == NULL) && + (cc = client_current()) == NULL) + return; + } else { /* (mb->flags == MOUSEBIND_CTX_ROOT) */ + if (e->window != e->root) return; cc = &fakecc; cc->sc = screen_fromroot(e->window); - } else if (cc == NULL) /* (mb->flags == MOUSEBIND_CTX_WIN */ - return; + } (*mb->callback)(cc, e); } |