From 14ac3391c5d071a67de062f4857280212e12afdb Mon Sep 17 00:00:00 2001 From: oga Date: Thu, 10 Dec 2009 17:16:51 +0000 Subject: 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@. --- xevents.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'xevents.c') diff --git a/xevents.c b/xevents.c index 62fe8b8..b914484 100644 --- a/xevents.c +++ b/xevents.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: xevents.c,v 1.44 2009/11/28 17:52:12 tobias Exp $ + * $Id: xevents.c,v 1.45 2009/12/10 17:16:51 oga Exp $ */ /* @@ -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); } -- cgit v1.2.3-2-gb3c3