add screen args to focus()

This commit is contained in:
Julien Danjou 2007-09-15 22:51:09 +02:00
parent bf4007eef5
commit 3cc29b0250
4 changed files with 20 additions and 20 deletions

View file

@ -257,7 +257,7 @@ detach(Client * c)
* \param awesomeconf awesome config * \param awesomeconf awesome config
*/ */
void 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 is NULL or invisible, take next client in the stack */
if((!c && selscreen) || (c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags))) 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); setclienttrans(sel, -1);
} }
else else
XSetInputFocus(disp, DefaultRootWindow(disp), RevertToPointerRoot, CurrentTime); XSetInputFocus(disp, RootWindow(disp, screen), RevertToPointerRoot, CurrentTime);
} }
/** Kill selected client /** Kill selected client
@ -366,8 +366,8 @@ manage(Display * disp, int screen, DC *drawcontext, Window w, XWindowAttributes
c->oldborder = wa->border_width; c->oldborder = wa->border_width;
c->display = disp; c->display = disp;
c->screen = screen; c->screen = screen;
if(c->w == DisplayWidth(disp, DefaultScreen(disp)) if(c->w == DisplayWidth(disp, screen)
&& c->h == DisplayHeight(disp, DefaultScreen(disp))) && c->h == DisplayHeight(disp, screen))
{ {
c->x = 0; c->x = 0;
c->y = 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) if(w <= 0 || h <= 0)
return; return;
/* offscreen appearance fixes */ /* offscreen appearance fixes */
if(x > DisplayWidth(c->display, DefaultScreen(c->display))) if(x > DisplayWidth(c->display, c->screen))
x = DisplayWidth(c->display, DefaultScreen(c->display)) - w - 2 * c->border; x = DisplayWidth(c->display, c->screen) - w - 2 * c->border;
if(y > DisplayHeight(c->display, DefaultScreen(c->display))) if(y > DisplayHeight(c->display, c->screen))
y = DisplayHeight(c->display, DefaultScreen(c->display)) - h - 2 * c->border; y = DisplayHeight(c->display, c->screen) - h - 2 * c->border;
if(x + w + 2 * c->border < 0) if(x + w + 2 * c->border < 0)
x = 0; x = 0;
if(y + h + 2 * c->border < 0) if(y + h + 2 * c->border < 0)
@ -515,7 +515,7 @@ uicb_moveresize(Display *disp __attribute__ ((unused)),
ow = sel->w; ow = sel->w;
oh = sel->h; 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); resize(sel, nx, ny, nw, nh, True);
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my) 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); detach(c);
detachstack(c); detachstack(c);
if(sel == 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); XUngrabButton(c->display, AnyButton, AnyModifier, c->win);
setclientstate(c, state); setclientstate(c, state);
XSync(c->display, False); 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. */ /* 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, if (XShapeQueryExtents(c->display, c->win, &bounding_shaped, &i, &i,
&u, &u, &b, &i, &i, &u, &u) && bounding_shaped) &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 void

View file

@ -53,7 +53,7 @@ void attach(Client *); /* attaches c to global client list */
void ban(Client *); /* bans c */ void ban(Client *); /* bans c */
void configure(Client *); /* send synthetic configure event */ void configure(Client *); /* send synthetic configure event */
void detach(Client *); /* detaches c from global client list */ 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 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 resize(Client *, int, int, int, int, Bool); /* resize with given coordinates c */
void unban(Client *); /* unbans c */ void unban(Client *); /* unbans c */

View file

@ -178,7 +178,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
} }
else if((c = getclient(ev->window))) 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) if(CLEANMASK(ev->state) != awesomeconf->modkey)
return; return;
if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating)) 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) if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
return; return;
if((c = getclient(ev->window))) 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)) 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 void
@ -327,7 +327,7 @@ handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf)
XCrossingEvent *ev = &e->xcrossing; XCrossingEvent *ev = &e->xcrossing;
if((ev->window == DefaultRootWindow(e->xany.display)) && !ev->same_screen) 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 void

View file

@ -43,7 +43,7 @@ arrange(Display * disp, DC *drawcontext, awesome_config *awesomeconf)
else else
ban(c); ban(c);
awesomeconf->current_layout->arrange(disp, awesomeconf); awesomeconf->current_layout->arrange(disp, awesomeconf);
focus(disp, drawcontext, NULL, True, awesomeconf); focus(disp, DefaultScreen(disp), drawcontext, NULL, True, awesomeconf);
restack(disp, drawcontext, 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); for(c = clients; c && !isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags); c = c->next);
if(c) if(c)
{ {
focus(c->display, drawcontext, c, True, awesomeconf); focus(c->display, c->screen, drawcontext, c, True, awesomeconf);
restack(c->display, drawcontext, awesomeconf); restack(c->display, drawcontext, awesomeconf);
} }
} }
@ -85,7 +85,7 @@ uicb_focusprev(Display *disp __attribute__ ((unused)),
} }
if(c) if(c)
{ {
focus(c->display, drawcontext, c, True, awesomeconf); focus(c->display, c->screen, drawcontext, c, True, awesomeconf);
restack(c->display, drawcontext, awesomeconf); restack(c->display, drawcontext, awesomeconf);
} }
} }
@ -274,7 +274,7 @@ uicb_zoom(Display *disp __attribute__ ((unused)),
return; return;
detach(sel); detach(sel);
attach(sel); attach(sel);
focus(sel->display, drawcontext, sel, True, awesomeconf); focus(sel->display, sel->screen, drawcontext, sel, True, awesomeconf);
arrange(sel->display, drawcontext, awesomeconf); arrange(sel->display, drawcontext, awesomeconf);
} }