diff options
author | oga <oga> | 2009-12-10 17:16:51 +0000 |
---|---|---|
committer | oga <oga> | 2009-12-10 17:16:51 +0000 |
commit | 134e777cf095ae292730e1c9d3f7967099878024 (patch) | |
tree | 80a226385db61bf2bdf72e0c0b3490f0930303e9 /xevents.c | |
parent | ee7df6a95f80bebc9ec2d8571c1ff8ff2f53cfd0 (diff) | |
download | cwm-134e777cf095ae292730e1c9d3f7967099878024.tar.gz cwm-134e777cf095ae292730e1c9d3f7967099878024.tar.xz cwm-134e777cf095ae292730e1c9d3f7967099878024.zip |
finish unfucking the screen_ctx handling.
remove screen_current() it was utterly bogus when nscreens > 1. pass a fake client_ctx in the case where there's no client and the kbfunc or mousefunc doesn't need a real one, it just contains the current screen, modify these functions so that they pass down the screen context to their callees. make groups per screen, it's the only way it makes sense in this regard. ok okan@.
Diffstat (limited to 'xevents.c')
-rw-r--r-- | xevents.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/xevents.c b/xevents.c index 8d24468..39586b1 100644 --- a/xevents.c +++ b/xevents.c @@ -227,7 +227,7 @@ static void xev_handle_buttonpress(XEvent *ee) { XButtonEvent *e = &ee->xbutton; - struct client_ctx *cc; + struct client_ctx *cc, fakecc; struct screen_ctx *sc; struct mousebinding *mb; @@ -244,15 +244,13 @@ xev_handle_buttonpress(XEvent *ee) if (mb == NULL) return; - if (mb->context == MOUSEBIND_CTX_ROOT) { if (e->window != sc->rootwin) return; - } else if (mb->context == MOUSEBIND_CTX_WIN) { - cc = client_find(e->window); - if (cc == NULL) - return; - } + cc = &fakecc; + cc->sc = screen_fromroot(e->window); + } else if (cc == NULL) /* (mb->context == MOUSEBIND_CTX_WIN */ + return; (*mb->callback)(cc, e); } @@ -270,7 +268,7 @@ static void xev_handle_keypress(XEvent *ee) { XKeyEvent *e = &ee->xkey; - struct client_ctx *cc = NULL; + struct client_ctx *cc = NULL, fakecc; struct keybinding *kb; KeySym keysym, skeysym; int modshift; @@ -298,12 +296,14 @@ xev_handle_keypress(XEvent *ee) if (kb == NULL) return; - - if ((kb->flags & (KBFLAG_NEEDCLIENT)) && - (cc = client_find(e->window)) == NULL && - (cc = client_current()) == NULL) - if (kb->flags & KBFLAG_NEEDCLIENT) + if (kb->flags & KBFLAG_NEEDCLIENT) { + if (((cc = client_find(e->window)) == NULL) && + (cc = client_current()) == NULL) return; + } else { + cc = &fakecc; + cc->sc = screen_fromroot(e->window); + } (*kb->callback)(cc, &kb->argument); } |