X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=tile.c;h=b7cc100dd6a28d83b205d7a21c246c69379a3eef;hb=a200c39635dcbd1cb1109353f9c2acab983c8606;hp=40e40e28435c6282139f47711f514a9ba0e2b279;hpb=2d81b78b853565a3e34a8a9190e2362a6fdde739;p=dwm.git diff --git a/tile.c b/tile.c index 40e40e2..b7cc100 100644 --- a/tile.c +++ b/tile.c @@ -4,24 +4,23 @@ /* static */ -static double master = MASTER; +static double mwfact = MWFACT; /* extern */ void -incmaster(const char *arg) { +addtomwfact(const char *arg) { double delta; - if(lt->arrange != tile) + if(isarrange(tile)) return; - /* arg handling, manipulate master */ + /* arg handling, manipulate mwfact */ if(arg && (1 == sscanf(arg, "%lf", &delta))) { - if(delta + master > 0.1 && delta + master < 0.9) - master += delta; + if(delta + mwfact > 0.1 && delta + mwfact < 0.9) + mwfact += delta; } - - lt->arrange(); + arrange(); } void @@ -33,50 +32,42 @@ tile(void) { n++; /* window geoms */ - mw = (n == 1) ? waw : master * waw; + mw = (n == 1) ? waw : mwfact * waw; th = (n > 1) ? wah / (n - 1) : 0; if(n > 1 && th < bh) th = wah; nx = wax; ny = way; - for(i = 0, c = clients; c; c = c->next) - if(isvisible(c)) { - unban(c); - if(c->isfloating) - continue; - c->ismax = False; - if(i == 0) { /* master */ - nw = mw - 2 * c->border; - nh = wah - 2 * c->border; - } - else { /* tile window */ - if(i == 1) { - ny = way; - nx += mw; - } - nw = waw - mw - 2 * c->border; - if(i + 1 == n) /* remainder */ - nh = (way + wah) - ny - 2 * c->border; - else - nh = th - 2 * c->border; + for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) { + c->ismax = False; + if(i == 0) { /* master */ + nw = mw - 2 * c->border; + nh = wah - 2 * c->border; + } + else { /* tile window */ + if(i == 1) { + ny = way; + nx += mw; } - resize(c, nx, ny, nw, nh, False); - if(n > 1 && th != wah) - ny += nh + 2 * c->border; - i++; + nw = waw - mw - 2 * c->border; + if(i + 1 == n) /* remainder */ + nh = (way + wah) - ny - 2 * c->border; + else + nh = th - 2 * c->border; } - else - ban(c); - focus(NULL); - restack(); + resize(c, nx, ny, nw, nh, False); + if(n > 1 && th != wah) + ny += nh + 2 * c->border; + i++; + } } void zoom(const char *arg) { Client *c; - if(!sel || lt->arrange == floating || sel->isfloating) + if(!sel || !isarrange(tile) || sel->isfloating) return; if((c = sel) == nexttiled(clients)) if(!(c = nexttiled(c->next))) @@ -84,5 +75,5 @@ zoom(const char *arg) { detach(c); attach(c); focus(c); - lt->arrange(); + arrange(); }