X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=client.c;h=f3d31cb2f5df633cb2eaeccd857ab9fce0c7f24e;hb=492c6f10fcf9acf74d84eb3fe005ecf2dd42611a;hp=3db14f5c945752e6f615eccfb44b28aa6dbf0416;hpb=c67dbb28e47b03eca0c7faddcf7c9862c41694b7;p=dwm.git diff --git a/client.c b/client.c index 3db14f5..f3d31cb 100644 --- a/client.c +++ b/client.c @@ -153,6 +153,14 @@ focus(Client *c) { } void +focustopvisible(void) { + Client *c; + + for(c = stack; c && !isvisible(c); c = c->snext); + focus(c); +} + +void killclient(const char *arg) { XEvent ev; @@ -297,6 +305,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 +391,6 @@ updatetitle(Client *c) { void unmanage(Client *c) { - Client *nc; XWindowChanges wc; wc.border_width = c->oldborder; @@ -391,10 +400,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) + focustopvisible(); XUngrabButton(dpy, AnyButton, AnyModifier, c->win); setclientstate(c, WithdrawnState); free(c->tags);