From 3cc29b0250e087fa64e053b494ab154b908a8aad Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Sat, 15 Sep 2007 22:51:09 +0200 Subject: [PATCH] add screen args to focus() --- client.c | 22 +++++++++++----------- client.h | 2 +- event.c | 8 ++++---- layout.c | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/client.c b/client.c index 89617a6a..9d35aec2 100644 --- a/client.c +++ b/client.c @@ -257,7 +257,7 @@ detach(Client * c) * \param awesomeconf awesome config */ void -focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, awesome_config *awesomeconf) +focus(Display *disp, int screen, 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, awesomeconf->selected_tags, awesomeconf->ntags))) @@ -290,7 +290,7 @@ focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, awesome_config setclienttrans(sel, -1); } else - XSetInputFocus(disp, DefaultRootWindow(disp), RevertToPointerRoot, CurrentTime); + XSetInputFocus(disp, RootWindow(disp, screen), RevertToPointerRoot, CurrentTime); } /** Kill selected client @@ -366,8 +366,8 @@ manage(Display * disp, int screen, DC *drawcontext, Window w, XWindowAttributes c->oldborder = wa->border_width; c->display = disp; c->screen = screen; - if(c->w == DisplayWidth(disp, DefaultScreen(disp)) - && c->h == DisplayHeight(disp, DefaultScreen(disp))) + if(c->w == DisplayWidth(disp, screen) + && c->h == DisplayHeight(disp, screen)) { c->x = 0; c->y = 0; @@ -467,10 +467,10 @@ resize(Client * c, int x, int y, int w, int h, Bool sizehints) if(w <= 0 || h <= 0) return; /* offscreen appearance fixes */ - if(x > DisplayWidth(c->display, DefaultScreen(c->display))) - x = DisplayWidth(c->display, DefaultScreen(c->display)) - w - 2 * c->border; - if(y > DisplayHeight(c->display, DefaultScreen(c->display))) - y = DisplayHeight(c->display, DefaultScreen(c->display)) - h - 2 * c->border; + if(x > DisplayWidth(c->display, c->screen)) + x = DisplayWidth(c->display, c->screen) - w - 2 * c->border; + if(y > DisplayHeight(c->display, c->screen)) + y = DisplayHeight(c->display, c->screen) - h - 2 * c->border; if(x + w + 2 * c->border < 0) x = 0; if(y + h + 2 * c->border < 0) @@ -515,7 +515,7 @@ uicb_moveresize(Display *disp __attribute__ ((unused)), ow = sel->w; oh = sel->h; - Bool xqp = XQueryPointer(sel->display, DefaultRootWindow(sel->display), &dummy, &dummy, &mx, &my, &dx, &dy, &dui); + Bool xqp = XQueryPointer(sel->display, RootWindow(sel->display, sel->screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui); resize(sel, nx, ny, nw, nh, True); if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my) { @@ -569,7 +569,7 @@ unmanage(Client * c, DC *drawcontext, long state, awesome_config *awesomeconf) detach(c); detachstack(c); if(sel == c) - focus(c->display, drawcontext, NULL, True, awesomeconf); + focus(c->display, c->screen, drawcontext, NULL, True, awesomeconf); XUngrabButton(c->display, AnyButton, AnyModifier, c->win); setclientstate(c, state); XSync(c->display, False); @@ -653,7 +653,7 @@ set_shape(Client *c) /* Logic to decide if we have a shaped window cribbed from fvwm-2.5.10. */ if (XShapeQueryExtents(c->display, c->win, &bounding_shaped, &i, &i, &u, &u, &b, &i, &i, &u, &u) && bounding_shaped) - XShapeCombineShape(c->display, DefaultRootWindow(c->display), ShapeBounding, 0, 0, c->win, ShapeBounding, ShapeSet); + XShapeCombineShape(c->display, RootWindow(c->display, c->screen), ShapeBounding, 0, 0, c->win, ShapeBounding, ShapeSet); } void diff --git a/client.h b/client.h index 959f8e4a..12a3e10e 100644 --- a/client.h +++ b/client.h @@ -53,7 +53,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 *, DC *, Client *, Bool, awesome_config *); /* focus c if visible && !NULL, or focus top visible */ +void focus(Display *, int, 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 ad5fdad5..c907a5b4 100644 --- a/event.c +++ b/event.c @@ -178,7 +178,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) } else if((c = getclient(ev->window))) { - focus(c->display, &dc, c, ev->same_screen, awesomeconf); + focus(c->display, c->screen, &dc, c, ev->same_screen, awesomeconf); if(CLEANMASK(ev->state) != awesomeconf->modkey) return; if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating)) @@ -293,9 +293,9 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf) if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) return; if((c = getclient(ev->window))) - focus(c->display, &dc, c, ev->same_screen, awesomeconf); + focus(c->display, c->screen, &dc, c, ev->same_screen, awesomeconf); else if(ev->window == DefaultRootWindow(e->xany.display)) - focus(e->xany.display, &dc, NULL, True, awesomeconf); + focus(e->xany.display, DefaultScreen(e->xany.display), &dc, NULL, True, awesomeconf); } void @@ -327,7 +327,7 @@ handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf) XCrossingEvent *ev = &e->xcrossing; if((ev->window == DefaultRootWindow(e->xany.display)) && !ev->same_screen) - focus(e->xany.display, &dc, NULL, ev->same_screen, awesomeconf); + focus(e->xany.display, DefaultScreen(e->xany.display), &dc, NULL, ev->same_screen, awesomeconf); } void diff --git a/layout.c b/layout.c index 819058dc..ee5fcfae 100644 --- a/layout.c +++ b/layout.c @@ -43,7 +43,7 @@ arrange(Display * disp, DC *drawcontext, awesome_config *awesomeconf) else ban(c); awesomeconf->current_layout->arrange(disp, awesomeconf); - focus(disp, drawcontext, NULL, True, awesomeconf); + focus(disp, DefaultScreen(disp), drawcontext, NULL, True, awesomeconf); restack(disp, drawcontext, awesomeconf); } @@ -62,7 +62,7 @@ uicb_focusnext(Display *disp __attribute__ ((unused)), for(c = clients; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next); if(c) { - focus(c->display, drawcontext, c, True, awesomeconf); + focus(c->display, c->screen, drawcontext, c, True, awesomeconf); restack(c->display, drawcontext, awesomeconf); } } @@ -85,7 +85,7 @@ uicb_focusprev(Display *disp __attribute__ ((unused)), } if(c) { - focus(c->display, drawcontext, c, True, awesomeconf); + focus(c->display, c->screen, drawcontext, c, True, awesomeconf); restack(c->display, drawcontext, awesomeconf); } } @@ -274,7 +274,7 @@ uicb_zoom(Display *disp __attribute__ ((unused)), return; detach(sel); attach(sel); - focus(sel->display, drawcontext, sel, True, awesomeconf); + focus(sel->display, sel->screen, drawcontext, sel, True, awesomeconf); arrange(sel->display, drawcontext, awesomeconf); } -- 2.11.4.GIT