void
focus(Client *c) {
- if(c && !isvisible(c))
- return;
+ if( !c && selscreen || c && !isvisible(c))
+ for(c = stack; c && !isvisible(c); c = c->snext);
if(sel && sel != c) {
grabbuttons(sel, False);
XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
XMoveWindow(dpy, w, c->x + 2 * sw, c->y);
XMapWindow(dpy, w);
setclientstate(c, NormalState);
- if(isvisible(c))
- focus(c);
+ focus(c);
lt->arrange();
}
if(!sel || lt->arrange == floating)
return;
sel->isfloating = !sel->isfloating;
+ if(sel->isfloating)
+ resize(sel, sel->x, sel->y, sel->w, sel->h, True);
lt->arrange();
}
void
unmanage(Client *c) {
- Client *nc;
XWindowChanges wc;
wc.border_width = c->oldborder;
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
detach(c);
detachstack(c);
- if(sel == c) {
- for(nc = stack; nc && !isvisible(nc); nc = nc->snext);
- focus(nc);
- }
+ if(sel == c)
+ focus(NULL);
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
setclientstate(c, WithdrawnState);
free(c->tags);