From bf9601f79cabfaffb867aca23d346a5ed0f99662 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 17 Sep 2007 13:39:18 +0200 Subject: [PATCH] simplify focus, get screen from awesomeconf --- client.c | 13 ++++++------- client.h | 2 +- event.c | 8 ++++---- layout.c | 8 ++++---- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/client.c b/client.c index da598a8f..11632da5 100644 --- a/client.c +++ b/client.c @@ -251,18 +251,17 @@ detach(Client * c) /** Give focus to client, or to first client if c is NULL * \param disp Display ref - * \param screen Screen number * \param drawcontext drawcontext ref * \param c client * \param selscreen True if current screen is selected * \param awesomeconf awesome config */ void -focus(Display *disp, int screen, DC *drawcontext, Client * c, Bool selscreen, awesome_config *awesomeconf) +focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, awesome_config *awesomeconf) { /* if c is NULL or invisible, take next client in the stack */ - if((!c && selscreen) || (c && !isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags))) - for(c = stack; c && !isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags); c = c->snext); + if((!c && selscreen) || (c && !isvisible(c, awesomeconf->screen, awesomeconf->selected_tags, awesomeconf->ntags))) + for(c = stack; c && !isvisible(c, awesomeconf->screen, awesomeconf->selected_tags, awesomeconf->ntags); c = c->snext); /* if a client was selected but it's not the current client, unfocus it */ if(sel && sel != c) @@ -280,7 +279,7 @@ focus(Display *disp, int screen, DC *drawcontext, Client * c, Bool selscreen, aw if(!selscreen) return; sel = c; - drawstatusbar(disp, screen, drawcontext, awesomeconf); + drawstatusbar(disp, awesomeconf->screen, drawcontext, awesomeconf); if(sel) { XSetWindowBorder(sel->display, sel->win, drawcontext->sel[ColBorder]); @@ -291,7 +290,7 @@ focus(Display *disp, int screen, DC *drawcontext, Client * c, Bool selscreen, aw setclienttrans(sel, -1); } else - XSetInputFocus(disp, RootWindow(disp, screen), RevertToPointerRoot, CurrentTime); + XSetInputFocus(disp, RootWindow(disp, awesomeconf->screen), RevertToPointerRoot, CurrentTime); } /** Kill selected client @@ -572,7 +571,7 @@ unmanage(Client * c, DC *drawcontext, long state, awesome_config *awesomeconf) detach(c); detachstack(c); if(sel == c) - focus(c->display, c->screen, drawcontext, NULL, True, awesomeconf); + focus(c->display, drawcontext, NULL, True, awesomeconf); XUngrabButton(c->display, AnyButton, AnyModifier, c->win); setclientstate(c, state); XSync(c->display, False); diff --git a/client.h b/client.h index 2808c0d8..0d471839 100644 --- a/client.h +++ b/client.h @@ -59,7 +59,7 @@ void attach(Client *); /* attaches c to global client list */ void ban(Client *); /* bans c */ void configure(Client *); /* send synthetic configure event */ void detach(Client *); /* detaches c from global client list */ -void focus(Display *, int, DC *, Client *, Bool, awesome_config *); /* focus c if visible && !NULL, or focus top visible */ +void focus(Display *, DC *, Client *, Bool, awesome_config *); /* focus c if visible && !NULL, or focus top visible */ void manage(Display *, int, DC *, Window, XWindowAttributes *, awesome_config *); /* manage new client */ void resize(Client *, int, int, int, int, Bool); /* resize with given coordinates c */ void unban(Client *); /* unbans c */ diff --git a/event.c b/event.c index 751be259..cf6103a2 100644 --- a/event.c +++ b/event.c @@ -181,7 +181,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) if((c = getclient(ev->window))) { - focus(c->display, c->screen, &dc[c->screen], c, ev->same_screen, &awesomeconf[c->screen]); + focus(c->display, &dc[c->screen], c, ev->same_screen, &awesomeconf[c->screen]); if(CLEANMASK(ev->state, c->screen) != awesomeconf[c->screen].modkey) return; if(ev->button == Button1) @@ -312,11 +312,11 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf) if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) return; if((c = getclient(ev->window))) - focus(c->display, c->screen, &dc[c->screen], c, ev->same_screen, &awesomeconf[c->screen]); + focus(c->display, &dc[c->screen], c, ev->same_screen, &awesomeconf[c->screen]); else for(screen = 0; screen < ScreenCount(e->xany.display); screen++) if(ev->window == RootWindow(e->xany.display, screen)) - focus(e->xany.display, screen, &dc[screen], NULL, True, &awesomeconf[screen]); + focus(e->xany.display, &dc[screen], NULL, True, &awesomeconf[screen]); } void @@ -358,7 +358,7 @@ handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf) for(screen = 0; screen < ScreenCount(e->xany.display); screen++) if((ev->window == RootWindow(e->xany.display, screen)) && !ev->same_screen) - focus(e->xany.display, screen, &dc[screen], NULL, ev->same_screen, &awesomeconf[screen]); + focus(e->xany.display, &dc[screen], NULL, ev->same_screen, &awesomeconf[screen]); } void diff --git a/layout.c b/layout.c index 9b23c4b7..df98fedf 100644 --- a/layout.c +++ b/layout.c @@ -47,7 +47,7 @@ arrange(Display * disp, int screen, DC *drawcontext, awesome_config *awesomeconf ban(c); } awesomeconf->current_layout->arrange(disp, screen, awesomeconf); - focus(disp, screen, drawcontext, NULL, True, awesomeconf); + focus(disp, drawcontext, NULL, True, awesomeconf); restack(disp, screen, drawcontext, awesomeconf); } @@ -67,7 +67,7 @@ uicb_focusnext(Display *disp __attribute__ ((unused)), for(c = clients; c && !isvisible(c, screen, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next); if(c) { - focus(c->display, screen, drawcontext, c, True, awesomeconf); + focus(c->display, drawcontext, c, True, awesomeconf); restack(c->display, screen, drawcontext, awesomeconf); } } @@ -91,7 +91,7 @@ uicb_focusprev(Display *disp __attribute__ ((unused)), } if(c) { - focus(c->display, screen, drawcontext, c, True, awesomeconf); + focus(c->display, drawcontext, c, True, awesomeconf); restack(c->display, screen, drawcontext, awesomeconf); } } @@ -285,7 +285,7 @@ uicb_zoom(Display *disp __attribute__ ((unused)), return; detach(sel); attach(sel); - focus(sel->display, sel->screen, drawcontext, sel, True, awesomeconf); + focus(sel->display, drawcontext, sel, True, awesomeconf); arrange(sel->display, sel->screen, drawcontext, awesomeconf); } -- 2.11.4.GIT