mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
bring buttonpress and keypress event handlers slightly closer together
This commit is contained in:
15
xevents.c
15
xevents.c
@@ -238,12 +238,8 @@ xev_handle_buttonpress(XEvent *ee)
|
|||||||
{
|
{
|
||||||
XButtonEvent *e = &ee->xbutton;
|
XButtonEvent *e = &ee->xbutton;
|
||||||
struct client_ctx *cc, fakecc;
|
struct client_ctx *cc, fakecc;
|
||||||
struct screen_ctx *sc;
|
|
||||||
struct mousebinding *mb;
|
struct mousebinding *mb;
|
||||||
|
|
||||||
sc = screen_fromroot(e->root);
|
|
||||||
cc = client_find(e->window);
|
|
||||||
|
|
||||||
e->state &= ~IGNOREMODMASK;
|
e->state &= ~IGNOREMODMASK;
|
||||||
|
|
||||||
TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
|
TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
|
||||||
@@ -253,13 +249,16 @@ xev_handle_buttonpress(XEvent *ee)
|
|||||||
|
|
||||||
if (mb == NULL)
|
if (mb == NULL)
|
||||||
return;
|
return;
|
||||||
if (mb->flags == MOUSEBIND_CTX_ROOT) {
|
if (mb->flags == MOUSEBIND_CTX_WIN) {
|
||||||
if (e->window != sc->rootwin)
|
if (((cc = client_find(e->window)) == NULL) &&
|
||||||
|
(cc = client_current()) == NULL)
|
||||||
|
return;
|
||||||
|
} else { /* (mb->flags == MOUSEBIND_CTX_ROOT) */
|
||||||
|
if (e->window != e->root)
|
||||||
return;
|
return;
|
||||||
cc = &fakecc;
|
cc = &fakecc;
|
||||||
cc->sc = screen_fromroot(e->window);
|
cc->sc = screen_fromroot(e->window);
|
||||||
} else if (cc == NULL) /* (mb->flags == MOUSEBIND_CTX_WIN */
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
(*mb->callback)(cc, e);
|
(*mb->callback)(cc, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user