X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.c;h=adf422e9934c800a39b946e3d95b80736f4b521d;hb=2c6be7239f932121b9e4526b01b957fcefc8345a;hp=3db14f5c945752e6f615eccfb44b28aa6dbf0416;hpb=c67dbb28e47b03eca0c7faddcf7c9862c41694b7;p=dwm.git diff --git a/client.c b/client.c index 3db14f5..adf422e 100644 --- a/client.c +++ b/client.c @@ -1,6 +1,4 @@ -/* © 2006-2007 Anselm R. Garbe - * © 2006-2007 Sander van Dijk - * See LICENSE file for license details. */ +/* See LICENSE file for copyright and license details. */ #include "dwm.h" #include #include @@ -129,8 +127,8 @@ detach(Client *c) { 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]); @@ -222,8 +220,7 @@ manage(Window w, XWindowAttributes *wa) { XMoveWindow(dpy, w, c->x + 2 * sw, c->y); XMapWindow(dpy, w); setclientstate(c, NormalState); - if(isvisible(c)) - focus(c); + focus(c); lt->arrange(); } @@ -297,6 +294,8 @@ togglefloating(const char *arg) { 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(); } @@ -381,7 +380,6 @@ updatetitle(Client *c) { void unmanage(Client *c) { - Client *nc; XWindowChanges wc; wc.border_width = c->oldborder; @@ -391,10 +389,8 @@ unmanage(Client *c) { 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);