[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Fri, 10 Dec 2010 11:15:41 +0000 (UTC)

changeset: 657:3214ae7e3478
tag: tip
user: Johannes Hofmann <Johannes.Hofmann_AT_gmx.de>
date: Fri Dec 10 12:15:30 2010 +0100
files: dwm.suckless.org/patches/nmaster-ncol.c dwm.suckless.org/patches/nmaster.md
description:
add nmaster-ncol.c patch


diff -r da725f7370a6 -r 3214ae7e3478 dwm.suckless.org/patches/nmaster-ncol.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/nmaster-ncol.c Fri Dec 10 12:15:30 2010 +0100
_AT_@ -0,0 +1,163 @@
+enum {MaxMon = 8};
+static int nmasters[MaxMon];
+static int initnm = 0;
+
+static void
+initnmaster(void) {
+ int i;
+
+ if(initnm)
+ return;
+ for(i = 0; i < MaxMon; i++)
+ nmasters[i] = nmaster;
+ initnm = 1;
+}
+
+static void
+incnmaster(const Arg *arg) {
+ if(!arg || !selmon->lt[selmon->sellt]->arrange || selmon->num >= MaxMon)
+ return;
+ nmasters[selmon->num] += arg->i;
+ if(nmasters[selmon->num] < 0)
+ nmasters[selmon->num] = 0;
+ arrange(NULL);
+}
+
+static void
+setnmaster(const Arg *arg) {
+ if(!arg || !selmon->lt[selmon->sellt]->arrange || selmon->num >= MaxMon)
+ return;
+ nmasters[selmon->num] = arg->i > 0 ? arg->i : 0;
+ arrange(NULL);
+}
+
+static void
+ntile(Monitor *m) {
+ int x, y, h, w, mw, nm;
+ unsigned int i, n;
+ Client *c;
+
+ initnmaster();
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ c = nexttiled(m->clients);
+ nm = m->num < MaxMon ? nmasters[m->num] : nmaster;
+ if(nm > n)
+ nm = n;
+ /* master */
+ if(nm > 0) {
+ mw = m->mfact * m->ww;
+ h = m->wh / nm;
+ if(h < bh)
+ h = m->wh;
+ y = m->wy;
+ for(i = 0; i < nm; i++, c = nexttiled(c->next)) {
+ resize(c, m->wx, y, (n == nm ? m->ww : mw) - 2 * c->bw,
+ ((i + 1 == nm) ? m->wy + m->wh - y : h) - 2 * c->bw, False);
+ if(h != m->wh)
+ y = c->y + HEIGHT(c);
+ }
+ n -= nm;
+ } else
+ mw = 0;
+ if(n == 0)
+ return;
+ /* tile stack */
+ x = m->wx + mw;
+ y = m->wy;
+ w = m->ww - mw;
+ h = m->wh / n;
+ if(h < bh)
+ h = m->wh;
+ for(i = 0; c; c = nexttiled(c->next), i++) {
+ resize(c, x, y, w - 2 * c->bw,
+ ((i + 1 == n) ? m->wy + m->wh - y : h) - 2 * c->bw, False);
+ if(h != m->wh)
+ y = c->y + HEIGHT(c);
+ }
+}
+
+static void
+ncol(Monitor *m) {
+ int x, y, h, w, mw, nm;
+ unsigned int i, n;
+ Client *c;
+
+ initnmaster();
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ c = nexttiled(m->clients);
+ nm = m->num < MaxMon ? nmasters[m->num] : nmaster;
+ if(nm > n)
+ nm = n;
+ /* master */
+ if(nm > 0) {
+ mw = (n == nm) ? m->ww : m->mfact * m->ww;
+ w = mw / nm;
+ x = m->wx;
+ for(i = 0; i < nm; i++, c = nexttiled(c->next)) {
+ resize(c, x, m->wy, w - 2 * c->bw, m->wh - 2 * c->bw, False);
+ x = c->x + WIDTH(c);
+ }
+ n -= nm;
+ } else
+ mw = 0;
+ if(n == 0)
+ return;
+ /* tile stack */
+ x = m->wx + mw;
+ y = m->wy;
+ w = m->ww - mw;
+ h = m->wh / n;
+ if(h < bh)
+ h = m->wh;
+ for(i = 0; c; c = nexttiled(c->next), i++) {
+ resize(c, x, y, w - 2 * c->bw,
+ ((i + 1 == n) ? m->wy + m->wh - y : h) - 2 * c->bw, False);
+ if(h != m->wh)
+ y = c->y + HEIGHT(c);
+ }
+}
+
+static void
+nbstack(Monitor *m) {
+ int x, y, h, w, mh, nm;
+ unsigned int i, n;
+ Client *c;
+
+ initnmaster();
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ c = nexttiled(m->clients);
+ nm = m->num < MaxMon ? nmasters[m->num] : nmaster;
+ if(nm > n)
+ nm = n;
+ /* master */
+ if(nm > 0) {
+ mh = m->mfact * m->wh;
+ w = m->ww / nm;
+ if(w < bh)
+ w = m->ww;
+ x = m->wx;
+ for(i = 0; i < nm; i++, c = nexttiled(c->next)) {
+ resize(c, x, m->wy, ((i + 1 == nm) ? m->wx + m->ww - x : w) - 2 * c->bw,
+ (n == nm ? m->wh : mh) - 2 * c->bw, False);
+ if(w != m->ww)
+ x = c->x + WIDTH(c);
+ }
+ n -= nm;
+ } else
+ mh = 0;
+ if(n == 0)
+ return;
+ /* tile stack */
+ x = m->wx;
+ y = m->wy + mh;
+ w = m->ww / n;
+ h = m->wh - mh;
+ if(w < bh)
+ w = m->ww;
+ for(i = 0; c; c = nexttiled(c->next), i++) {
+ resize(c, x, y, ((i + 1 == n) ? m->wx + m->ww - x : w) - 2 * c->bw,
+ h - 2 * c->bw, False);
+ if(w != m->ww)
+ x = c->x + WIDTH(c);
+ }
+}
diff -r da725f7370a6 -r 3214ae7e3478 dwm.suckless.org/patches/nmaster.md
--- a/dwm.suckless.org/patches/nmaster.md Wed Dec 08 11:03:44 2010 +0100
+++ b/dwm.suckless.org/patches/nmaster.md Fri Dec 10 12:15:30 2010 +0100
_AT_@ -54,6 +54,7 @@
 
 ## Download
 
+* [nmaster-ncol.c](nmaster-ncol.c) (dwm 5.9) (20101210) - additional ncol layout (multiple masters side by side)
 * [nmaster-sym.c](nmaster-sym.c) (dwm 5.7.1) (20090927) - layout symbol shows the number of masters: `n]=`, `TnT`
 * [nmaster.c](nmaster.c) (dwm 5.6.1) (20090908)
 * see older versions in [historical patches](historical)
Received on Fri Dec 10 2010 - 12:15:41 CET

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:31:33 CEST