X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=view.c;h=90080fb1f5bbdef26cf101ff5074ab28b6f46066;hb=14d05e7c725a4a07136ceb123cf760272afc1a87;hp=dab812854caa3f0a132eaa98b71f18b901e6c75d;hpb=1c2d673ded697f4b131f8700ce98392fbb383b2e;p=dwm.git diff --git a/view.c b/view.c index dab8128..90080fb 100644 --- a/view.c +++ b/view.c @@ -65,6 +65,8 @@ togglemax(Client *c) /* extern */ void (*arrange)(Arg *) = DEFMODE; +Bool isvertical = VERTICALSTACK; +StackPos stackpos = STACKPOS; void detach(Client *c) { @@ -95,19 +97,39 @@ dofloat(Arg *arg) { restack(); } +/* This algorithm is based on a (M)aster area and a (S)tacking area. + * It supports following arrangements: + * MMMS MMMM SMMM + * MMMS MMMM SMMM + * MMMS SSSS SMMM + */ void dotile(Arg *arg) { int h, i, n, w; Client *c; - w = sw - mw; for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) n++; - if(n > 1) - h = (sh - bh) / (n - 1); - else - h = sh - bh; + if(isvertical) { + if(stackpos == StackBottom) { + w = sw; + if(n > 1) + h = (sh - bh) / (n - 1); + else + h = sh - bh; + } + else { + w = sw - master; + if(n > 1) + h = (sh - bh) / (n - 1); + else + h = sh - bh; + } + } + else { /* horizontal stack */ + + } for(i = 0, c = clients; c; c = c->next) { if(isvisible(c)) { @@ -125,11 +147,11 @@ dotile(Arg *arg) { else if(i == 0) { c->x = sx; c->y = sy + bh; - c->w = mw - 2 * BORDERPX; + c->w = master - 2 * BORDERPX; c->h = sh - 2 * BORDERPX - bh; } else if(h > bh) { - c->x = sx + mw; + c->x = sx + master; c->y = sy + (i - 1) * h + bh; c->w = w - 2 * BORDERPX; if(i + 1 == n) @@ -138,7 +160,7 @@ dotile(Arg *arg) { c->h = h - 2 * BORDERPX; } else { /* fallback if h < bh */ - c->x = sx + mw; + c->x = sx + master; c->y = sy + bh; c->w = w - 2 * BORDERPX; c->h = sh - 2 * BORDERPX - bh; @@ -210,14 +232,14 @@ resizecol(Arg *arg) { return; if(sel == getnext(clients)) { - if(mw + arg->i > sw - 100 || mw + arg->i < 100) + if(master + arg->i > sw - 100 || master + arg->i < 100) return; - mw += arg->i; + master += arg->i; } else { - if(mw - arg->i > sw - 100 || mw - arg->i < 100) + if(master - arg->i > sw - 100 || master - arg->i < 100) return; - mw -= arg->i; + master -= arg->i; } arrange(NULL); }