# HG changeset patch # User paulo # Date 1523326124 21600 # Node ID 85763b447d0fc66010c306b8bdad3354f40560ff # Parent d65207f4021a863806b94d2b239f8394f5d3dfcf add dwindle_m layout diff -r d65207f4021a -r 85763b447d0f layout.c --- a/layout.c Wed Sep 19 00:10:25 2012 -0700 +++ b/layout.c Mon Apr 09 20:08:44 2018 -0600 @@ -68,6 +68,74 @@ } static void +dwindle_m(void) { + unsigned int i, j, n, nx, ny, nw, nh, mn, mr, mx, mw; + unsigned int m = 2; + //unsigned int m = nmaster; + Client *c; + + nx = wax; + //ny = way + wah; + ny = 0; + nw = waw; + nh = wah; + mx = nx; + mw = nw / m; + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) + n++; + mn = n / m; + mr = n % m; + for(i = 0, j = 0, c = clients; c; c = c->next) + if(isvisible(c)) { + if(c->isbanned) + XMoveWindow(dpy, c->win, c->x, c->y); + c->isbanned = False; + if(c->isversatile) + continue; + c->ismax = False; + if((i % 2 && nh / 2 > 2 * c->border) + || (!(i % 2) && nw / 2 > 2 * c->border)) + { + if((j % m) == 0) { + if(i < mn - (mr > 0 ? 0 : 1)) { + if(i % 2) + nh /= 2; + else { + nw /= 2; + mw = nw / m; + } + } + else if(mr) + mw = nw / mr; + if((i % 4) == 0) + //ny -= nh; + ny += (i == 0 ? way : nh); + else if((i % 4) == 1) + nx += nw; + else if((i % 4) == 2) + ny += nh; + else + //nx -= nw; + nx += nw; + i++; + } + mx = nx + (j % m) * mw; + j++; + } + resize(c, mx, ny, mw - 2 * c->border, nh - 2 * c->border, False); + } + else { + c->isbanned = True; + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); + } + if(!sel || !isvisible(sel)) { + for(c = stack; c && !isvisible(c); c = c->snext); + focus(c); + } + restack(); +} + +static void spiral_h(void) { unsigned int i, n, nx, ny, nw, nh; Client *c;