diff -up dwm-2.8/dwm.h dwm-2.8-smaster/dwm.h --- dwm-2.8/dwm.h 2007-01-02 14:52:53.000000000 +0100 +++ dwm-2.8-smaster/dwm.h 2007-01-05 14:29:03.000000000 +0100 @@ -100,7 +100,7 @@ extern unsigned int master, ntags, numlo extern void (*handler[LASTEvent])(XEvent *); /* event handler */ extern void (*arrange)(void); /* arrange function, indicates mode */ extern Atom wmatom[WMLast], netatom[NetLast]; -extern Bool running, issel, *seltag; /* seltag is array of Bool */ +extern Bool running, issel, *seltag, hassm; /* seltag is array of Bool */ extern Client *clients, *sel, *stack; /* global client list and stack */ extern Cursor cursor[CurLast]; extern DC dc; /* global draw context */ diff -up dwm-2.8/view.c dwm-2.8-smaster/view.c --- dwm-2.8/view.c 2007-01-02 14:52:53.000000000 +0100 +++ dwm-2.8-smaster/view.c 2007-01-05 16:56:55.000000000 +0100 @@ -36,6 +36,7 @@ togglemax(Client *c) { /* extern */ +Bool hassm = True; void (*arrange)(void) = DEFMODE; void @@ -69,12 +70,27 @@ dofloat(void) { void dotile(void) { - unsigned int i, n, mpw, th; + unsigned int i, n, mpw, mph, th; + Bool smaster = hassm; Client *c; - for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) n++; - mpw = (waw * master) / 1000; + + if(n < 2) + smaster = False; + + if(smaster) { + mph = (wah * master) / 1000; + n--; + } + else + mph = wah; + + if(n <= 1) + mpw = waw; + else + mpw = (waw * master) / 1000; + for(i = 0, c = clients; c; c = c->next) if(isvisible(c)) { @@ -85,20 +101,22 @@ dotile(void) { c->ismax = False; c->x = wax; c->y = way; - if(n == 1) { /* only 1 window */ - c->w = waw - 2 * BORDERPX; - c->h = wah - 2 * BORDERPX; + if(i == 0) { /* primary master window */ + c->w = mpw - 2 * BORDERPX; + c->h = mph - 2 * BORDERPX; + if(n != 1) + th = wah / (n - 1); } - else if(i == 0) { /* master window */ + else if(i == 1 && smaster) { /* secondary master window */ + c->y += mph; c->w = mpw - 2 * BORDERPX; - c->h = wah - 2 * BORDERPX; - th = wah / (n - 1); + c->h = (wah-mph) - 2 * BORDERPX; } else { /* tile window */ c->x += mpw; c->w = (waw - mpw) - 2 * BORDERPX; if(th > bh) { - c->y += (i - 1) * th; + c->y += (i - 1 - smaster) * th; c->h = th - 2 * BORDERPX; } else /* fallback if th < bh */ @@ -254,14 +272,29 @@ zoom(Arg *arg) { n++; if(n < 2 || (arrange == dofloat)) return; - if((c = sel) == nexttiled(clients)) - if(!(c = nexttiled(c->next))) - return; - detach(c); - if(clients) + + c = sel; + if(!clients) { + c->next = clients; + clients = c; + } + if(c == nexttiled(clients)) + hassm = False; + else if(hassm == True && c == nexttiled(clients->next)) { + detach(c); clients->prev = c; - c->next = clients; - clients = c; + c->next = clients; + clients = c; + } + else { + hassm = True; + detach(c); + c->next = clients->next; + clients->next = c; + c->prev = clients; + c->next->prev = c; + } + focus(c); arrange(); }