Just rework the mouse binding calculation on event to look like the

kbfunc one.  Makes the code a lot easier to read.

Fixes a bug i introduced in the last commit here.

ok okan.
This commit is contained in:
oga 2008-06-17 20:55:48 +00:00
parent 9657664c7b
commit 19ba704ee3

View File

@ -228,26 +228,24 @@ xev_handle_buttonpress(struct xevent *xev, XEvent *ee)
cc = client_find(e->window); cc = client_find(e->window);
if (e->window == sc->rootwin) { TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) { if (e->button == mb->button && e->state == mb->modmask)
if (e->button == mb->button && e->state == mb->modmask break;
&& mb->context == MOUSEBIND_CTX_ROOT) {
(*mb->callback)(cc, e);
break;
}
}
} }
if (cc == NULL || e->state == 0) if (mb == NULL)
goto out; goto out;
TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) { if (mb->context == MOUSEBIND_CTX_ROOT) {
if (e->button == mb->button && e->state == mb->modmask && if (e->window != sc->rootwin)
mb->context == MOUSEBIND_CTX_ROOT) { goto out;
(*mb->callback)(cc, NULL); } else if (mb->context == MOUSEBIND_CTX_WIN) {
break; cc = client_find(e->window);
} if (cc == NULL)
goto out;
} }
(*mb->callback)(cc, e);
out: out:
xev_register(xev); xev_register(xev);
} }