X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=tile.c;h=56a06d36a05a651d12a84fcd7378625dfbcb0f37;hp=d03e4faa7df63a9a2be26900c1f13bf2a732f1c9;hb=2091200c957783deed032380d56c4199a23c6b81;hpb=77044e876511f51c34bde379d89e2de754707ee6 diff --git a/tile.c b/tile.c index d03e4fa..56a06d3 100644 --- a/tile.c +++ b/tile.c @@ -9,16 +9,23 @@ static double mwfact = MWFACT; /* extern */ void -addtomwfact(const char *arg) { +setmwfact(const char *arg) { double delta; - if(isarrange(tile)) + if(!isarrange(tile)) return; - /* arg handling, manipulate mwfact */ - if(arg && (1 == sscanf(arg, "%lf", &delta))) { - if(delta + mwfact > 0.1 && delta + mwfact < 0.9) + if(arg == NULL) + mwfact = MWFACT; + else if(1 == sscanf(arg, "%lf", &delta)) { + if(arg[0] != '+' && arg[0] != '-') + mwfact = delta; + else mwfact += delta; + if(mwfact < 0.1) + mwfact = 0.1; + else if(mwfact > 0.9) + mwfact = 0.9; } arrange(); } @@ -39,31 +46,27 @@ tile(void) { nx = wax; ny = way; - for(i = 0, c = clients; c; c = c->next) - if(isvisible(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), i++) { + 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; } + resize(c, nx, ny, nw, nh, RESIZEHINTS); + if(n > 1 && th != wah) + ny += nh + 2 * c->border; + } } void