X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=layout.c;h=de6aef63903ed61a5a922cb2c9e97d156c4062cf;hb=199a6016114875656102d11e79a80939bfaff3b3;hp=4b4e908d030ec67a3a1218ed4be30fad9684232a;hpb=492c6f10fcf9acf74d84eb3fe005ecf2dd42611a;p=dwm.git diff --git a/layout.c b/layout.c index 4b4e908..de6aef6 100644 --- a/layout.c +++ b/layout.c @@ -14,6 +14,22 @@ static unsigned int masterw = MASTERWIDTH; static unsigned int nmaster = NMASTER; static void +ban(Client *c) { + if (c->isbanned) + return; + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); + c->isbanned = True; +} + +static void +unban(Client *c) { + if (!c->isbanned) + return; + XMoveWindow(dpy, c->win, c->x, c->y); + c->isbanned = False; +} + +static void tile(void) { unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; Client *c; @@ -28,9 +44,7 @@ tile(void) { for(i = 0, c = clients; c; c = c->next) if(isvisible(c)) { - if(c->isbanned) - XMoveWindow(dpy, c->win, c->x, c->y); - c->isbanned = False; + unban(c); if(c->isfloating) continue; c->ismax = False; @@ -60,12 +74,9 @@ tile(void) { resize(c, nx, ny, nw, nh, False); i++; } - else { - c->isbanned = True; - XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); - } - if(!sel || !isvisible(sel)) - focustopvisible(); + else + ban(c); + focus(NULL); restack(); } @@ -77,20 +88,16 @@ void floating(void) { Client *c; - for(c = clients; c; c = c->next) { + for(c = clients; c; c = c->next) if(isvisible(c)) { if(c->isbanned) XMoveWindow(dpy, c->win, c->x, c->y); c->isbanned = False; resize(c, c->x, c->y, c->w, c->h, True); } - else { - c->isbanned = True; - XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); - } - } - if(!sel || !isvisible(sel)) - focustopvisible(); + else + ban(c); + focus(NULL); restack(); }