diff options
author | oga <oga> | 2008-06-17 20:21:17 +0000 |
---|---|---|
committer | oga <oga> | 2008-06-17 20:21:17 +0000 |
commit | 9657664c7bd1b6fe61bf0605a8503569ec79e10e (patch) | |
tree | 3e4745105edfa3d8402279e83c3f2aaefd6d86cd | |
parent | 867652c484176909c61c74f59ba240039c8b9a1b (diff) | |
download | cwm-9657664c7bd1b6fe61bf0605a8503569ec79e10e.tar.gz cwm-9657664c7bd1b6fe61bf0605a8503569ec79e10e.tar.xz cwm-9657664c7bd1b6fe61bf0605a8503569ec79e10e.zip |
The mousebinding code missing a break once it had found the correct
binding, this expose another issue that's still being debugged. Issue pointed out by Dan Harnett, thanks! While i'm here KNF and rework the logic to not be ass-backwards. ok okan.
-rw-r--r-- | xevents.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/xevents.c b/xevents.c index e70d218..b529580 100644 --- a/xevents.c +++ b/xevents.c @@ -220,32 +220,33 @@ xev_handle_leavenotify(struct xevent *xev, XEvent *ee) void xev_handle_buttonpress(struct xevent *xev, XEvent *ee) { - XButtonEvent *e = &ee->xbutton; - struct client_ctx *cc; - struct screen_ctx *sc = screen_fromroot(e->root); - char *wname; - struct mousebinding *mb; + XButtonEvent *e = &ee->xbutton; + struct client_ctx *cc; + struct screen_ctx *sc = screen_fromroot(e->root); + struct mousebinding *mb; + char *wname; cc = client_find(e->window); - if (sc->rootwin == e->window) + if (e->window == sc->rootwin) { TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) { - if(e->button!=mb->button || e->state!=mb->modmask || - mb->context!=MOUSEBIND_CTX_ROOT) - continue; - (*mb->callback)(cc, e); + if (e->button == mb->button && e->state == mb->modmask + && mb->context == MOUSEBIND_CTX_ROOT) { + (*mb->callback)(cc, e); + break; + } } + } if (cc == NULL || e->state == 0) goto out; TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) { - if(e->button!=mb->button || e->state!=mb->modmask || - mb->context!=MOUSEBIND_CTX_WIN) - continue; - - (*mb->callback)(cc, NULL); - break; + if (e->button == mb->button && e->state == mb->modmask && + mb->context == MOUSEBIND_CTX_ROOT) { + (*mb->callback)(cc, NULL); + break; + } } out: xev_register(xev); |