X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=view.c;h=503f1c2ba46377e2fad3b60d2332b0c5fc320ad4;hb=e9cfae7aba1c8eafd827854705bf0d11d2de2dfb;hp=793151d36b36bb3383d6cff93584c2722ee836b5;hpb=d939f301fa5ee472f2b089496b5e873ec155fa8e;p=dwm.git diff --git a/view.c b/view.c index 793151d..503f1c2 100644 --- a/view.c +++ b/view.c @@ -11,40 +11,6 @@ nexttiled(Client *c) { return c; } -static Bool -ismaster(Client *c) { - Client *cl; - unsigned int i; - - for(cl = nexttiled(clients), i = 0; cl && cl != c; cl = nexttiled(cl->next), i++); - return i < nmaster; -} - -static void -pop(Client *c) { - detach(c); - if(clients) - clients->prev = c; - c->next = clients; - clients = c; -} - -static void -swap(Client *c1, Client *c2) { - Client tmp = *c1; - Client *cp = c1->prev; - Client *cn = c1->next; - - *c1 = *c2; - c1->prev = cp; - c1->next = cn; - cp = c2->prev; - cn = c2->next; - *c2 = tmp; - c2->prev = cp; - c2->next = cn; -} - static void togglemax(Client *c) { XEvent ev; @@ -68,15 +34,6 @@ togglemax(Client *c) { while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); } -static Client * -topofstack() { - Client *c; - unsigned int i; - - for(c = nexttiled(clients), i = 0; c && i < nmaster; c = nexttiled(c->next), i++); - return (i < nmaster) ? NULL : c; -} - /* extern */ void (*arrange)(void) = DEFMODE; @@ -192,10 +149,9 @@ focusprev(Arg *arg) { void incnmaster(Arg *arg) { - if(nmaster + arg->i < 1 || (wah / (nmaster + arg->i) < bh)) + if((nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh)) return; nmaster += arg->i; - arrange(); } @@ -305,17 +261,13 @@ zoom(Arg *arg) { n++; c = sel; - if(n <= nmaster || (arrange == dofloat)) - pop(c); - else if(ismaster(sel)) { - if(!(c = topofstack())) - return; - swap(c, sel); - c = sel; + if((arrange != dofloat) && c != nexttiled(clients)) { + detach(c); + if(clients) + clients->prev = c; + c->next = clients; + clients = c; + focus(c); + arrange(); } - else - pop(c); - - focus(c); - arrange(); }