dwm

my customized branch of dwm
git clone git://git.jakekoroman.com/dwm
Log | Files | Refs | README | LICENSE

commit 14d05e7c725a4a07136ceb123cf760272afc1a87
parent a118a57fe3fd13036f24ebe093a5c329608a0600
Author: Anselm R. Garbe <arg@10kloc.org>
Date:   Fri, 29 Sep 2006 12:38:27 +0200

first step to a more flexible dotile() algorithm
Diffstat:
Mconfig.arg.h | 6++++--
Mconfig.default.h | 4+++-
Mconfig.mk | 2+-
Mdwm.h | 8+++++++-
Mevent.c | 5++++-
Mmain.c | 4++--
Mview.c | 58+++++++++++++++++++++++++++++++---------------------------
7 files changed, 52 insertions(+), 35 deletions(-)

diff --git a/config.arg.h b/config.arg.h @@ -6,9 +6,11 @@ #define TAGS \ const char *tags[] = { "dev", "work", "net", "fnord", NULL }; -#define DEFMODE dotile /* dofloat */ +#define DEFMODE dotile /* dofloat */ #define FLOATSYMBOL "><>" +#define STACKPOS StackRight /* StackLeft, StackBottom */ #define TILESYMBOL "[]=" +#define VERTICALSTACK True /* False == horizontal stack */ #define FONT "-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*" #define NORMBGCOLOR "#333333" @@ -18,7 +20,7 @@ const char *tags[] = { "dev", "work", "net", "fnord", NULL }; #define STATUSBGCOLOR "#222222" #define STATUSFGCOLOR "#9999cc" -#define MASTERW 60 /* percent */ +#define MASTER 60 /* percent */ #define MODKEY Mod1Mask #define KEYS \ diff --git a/config.default.h b/config.default.h @@ -8,7 +8,9 @@ const char *tags[] = { "1", "2", "3", "4", "5", NULL }; #define DEFMODE dotile /* dofloat */ #define FLOATSYMBOL "><>" +#define STACKPOS StackRight /* StackLeft, StackBottom */ #define TILESYMBOL "[]=" +#define VERTICALSTACK True /* False == horizontal stack */ #define FONT "fixed" #define NORMBGCOLOR "#333366" @@ -18,7 +20,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", NULL }; #define STATUSBGCOLOR "#dddddd" #define STATUSFGCOLOR "#222222" -#define MASTERW 60 /* percent */ +#define MASTER 60 /* percent */ #define MODKEY Mod1Mask #define KEYS \ diff --git a/config.mk b/config.mk @@ -1,5 +1,5 @@ # dwm version -VERSION = 1.7.1 +VERSION = 1.8 # Customize below to fit your system diff --git a/dwm.h b/dwm.h @@ -48,6 +48,10 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { ColFG, ColBG, ColLast }; /* color */ typedef enum { + StackLeft, StackBottom, StackRight +} StackPos; /* stack position*/ + +typedef enum { TopLeft, TopRight, BotLeft, BotRight } Corner; /* window corners */ @@ -97,16 +101,18 @@ struct Client { extern const char *tags[]; /* all tags */ extern char stext[1024]; /* status text */ extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */ -extern int mw, screen, sx, sy, sw, sh; /* screen geometry, master width */ +extern int master, screen, sx, sy, sw, sh; /* screen geometry, master width */ extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */ extern void (*handler[LASTEvent])(XEvent *); /* event handler */ extern void (*arrange)(Arg *); /* arrange function, indicates mode */ extern Atom wmatom[WMLast], netatom[NetLast]; extern Bool running, issel, *seltag; /* seltag is array of Bool */ +extern Bool isvertical; /* stack direction */ extern Client *clients, *sel, *stack; /* global client list and stack */ extern Cursor cursor[CurLast]; extern DC dc; /* global draw context */ extern Display *dpy; +extern StackPos stackpos; extern Window root, barwin; /* client.c */ diff --git a/event.c b/event.c @@ -176,8 +176,11 @@ configurerequest(XEvent *e) { else configure(c); XSync(dpy, False); - if(c->isfloat) + if(c->isfloat) { resize(c, False, TopLeft); + if(!isvisible(c)) + ban(c); + } else arrange(NULL); } diff --git a/main.c b/main.c @@ -19,7 +19,7 @@ char stext[1024]; Bool *seltag; -int bx, by, bw, bh, bmw, mw, screen, sx, sy, sw, sh; +int bx, by, bw, bh, bmw, master, screen, sx, sy, sw, sh; unsigned int ntags, numlockmask; Atom wmatom[WMLast], netatom[NetLast]; Bool running = True; @@ -133,7 +133,7 @@ setup(void) { sx = sy = 0; sw = DisplayWidth(dpy, screen); sh = DisplayHeight(dpy, screen); - mw = (sw * MASTERW) / 100; + master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100; bx = by = 0; bw = sw; diff --git 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) { @@ -97,35 +99,37 @@ dofloat(Arg *arg) { /* This algorithm is based on a (M)aster area and a (S)tacking area. * It supports following arrangements: - * - * MMMS MMMM - * MMMS MMMM - * MMMS SSSS - * - * The stacking area can be set to arrange clients vertically or horizontally. - * Through inverting the algorithm it can be used to achieve following setup in - * a dual head environment (due to running two dwm instances concurrently on - * the specific screen): - * - * SMM MMS MMM MMM - * SMM MMS MMM MMM - * SMM MMS SSS SSS - * - * This uses the center of the two screens for master areas. + * 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)) { @@ -143,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) @@ -156,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; @@ -228,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); }