tadded the new dotile as described on ml - dwm - [fork] customized build of dwm… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit fee8df6ccf3ab1494421d422af252f7b3da3a811 | |
parent 8fa47ac679cfd91c022a35f2469bea7396e5f7c7 | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Fri, 29 Sep 2006 16:22:20 +0200 | |
added the new dotile as described on ml | |
Diffstat: | |
M config.arg.h | 2 ++ | |
M config.default.h | 2 ++ | |
M dwm.h | 9 ++++++--- | |
M event.c | 5 +++-- | |
M main.c | 2 +- | |
M view.c | 128 +++++++++++++++++++++++------… | |
6 files changed, 112 insertions(+), 36 deletions(-) | |
--- | |
diff --git a/config.arg.h b/config.arg.h | |
t@@ -36,6 +36,8 @@ static Key key[] = { \ | |
{ MODKEY, XK_j, focusnext, … | |
{ MODKEY, XK_k, focusprev, … | |
{ MODKEY, XK_Return, zoom, … | |
+ { MODKEY, XK_b, togglestackpos, … | |
+ { MODKEY, XK_d, togglestackdir, … | |
{ MODKEY, XK_g, resizecol, … | |
{ MODKEY, XK_s, resizecol, … | |
{ MODKEY|ShiftMask, XK_1, tag, … | |
diff --git a/config.default.h b/config.default.h | |
t@@ -30,6 +30,8 @@ static Key key[] = { \ | |
{ MODKEY, XK_Tab, focusnext, … | |
{ MODKEY|ShiftMask, XK_Tab, focusprev, … | |
{ MODKEY, XK_Return, zoom, … | |
+ { MODKEY, XK_b, togglestackpos, … | |
+ { MODKEY, XK_d, togglestackdir, … | |
{ MODKEY, XK_g, resizecol, … | |
{ MODKEY, XK_s, resizecol, … | |
{ MODKEY|ShiftMask, XK_1, tag, … | |
diff --git a/dwm.h b/dwm.h | |
t@@ -102,7 +102,7 @@ struct Client { | |
extern const char *tags[]; /* all tags */ | |
extern char stext[1024]; /* status text */ | |
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mo… | |
-extern int master, screen, sx, sy, sw, sh; /* screen geometry, master w… | |
+extern int master, screen, sx, sy, sw, sh; /* screen geometry, master d… | |
extern unsigned int ntags, numlockmask; /* number of tags, dyna… | |
extern void (*handler[LASTEvent])(XEvent *); /* event handler */ | |
extern void (*arrange)(Arg *); /* arrange function, ind… | |
t@@ -170,10 +170,13 @@ extern void dotile(Arg *arg); /* … | |
extern void focusnext(Arg *arg); /* focuses next visible client… | |
extern void focusprev(Arg *arg); /* focuses previous visible cl… | |
extern Bool isvisible(Client *c); /* returns True if client is … | |
-extern void resizecol(Arg *arg); /* resizes the master width wi… | |
+extern void resizecol(Arg *arg); /* resizes the master dimensio… | |
extern void restack(void); /* restores z layers of all … | |
+extern void togglestackdir(Arg *arg); /* toggles stack directio… | |
+extern void togglestackpos(Arg *arg); /* toggles stack position… | |
extern void togglemode(Arg *arg); /* toggles global arrange fun… | |
extern void toggleview(Arg *arg); /* toggles the tag with arg's… | |
+extern void updatemaster(void); /* updates master dimen… | |
extern void view(Arg *arg); /* views the tag with arg's… | |
extern void viewall(Arg *arg); /* views all tags, arg i… | |
-extern void zoom(Arg *arg); /* zooms the focused client… | |
+extern void zoom(Arg *arg); /* zooms the focused client… | |
diff --git a/event.c b/event.c | |
t@@ -177,8 +177,9 @@ configurerequest(XEvent *e) { | |
configure(c); | |
XSync(dpy, False); | |
if(c->isfloat) { | |
- if(isvisible(c)) | |
- resize(c, False, TopLeft); | |
+ resize(c, False, TopLeft); | |
+ if(!isvisible(c)) | |
+ ban(c); | |
} | |
else | |
arrange(NULL); | |
diff --git a/main.c b/main.c | |
t@@ -133,7 +133,7 @@ setup(void) { | |
sx = sy = 0; | |
sw = DisplayWidth(dpy, screen); | |
sh = DisplayHeight(dpy, screen); | |
- master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100; | |
+ updatemaster(); | |
bx = by = 0; | |
bw = sw; | |
diff --git a/view.c b/view.c | |
t@@ -148,52 +148,93 @@ dotile(Arg *arg) { | |
c->h = sh - 2 * BORDERPX - bh; | |
} | |
else if(i == 0) { /* master window */ | |
- c->x = sx; | |
- if(stackpos == StackLeft) | |
- c->x += master; | |
- c->y = sy + bh; | |
- if(isvertical) { | |
+ switch(stackpos) { | |
+ case StackLeft: | |
+ c->x = sx + stackw; | |
+ c->y = sy + bh; | |
c->w = master - 2 * BORDERPX; | |
- c->h = sh - 2 * BORDERPX - bh; | |
- } | |
- else { | |
- c->w = sw; | |
+ c->h = sh - bh - 2 * BORDERPX; | |
+ break; | |
+ case StackBottom: | |
+ c->x = sx; | |
+ c->y = sy + bh; | |
+ c->w = sw - 2 * BORDERPX; | |
c->h = master - 2 * BORDERPX; | |
+ break; | |
+ case StackRight: | |
+ c->x = sx; | |
+ c->y = sy + bh; | |
+ c->w = master - 2 * BORDERPX; | |
+ c->h = sh - bh - 2 * BORDERPX; | |
+ break; | |
} | |
} | |
else if((isvertical && th > bh) || (!isvertical && tw … | |
/* tile window */ | |
- c->x = sx; | |
- if(isvertical) | |
- c->y = sy + (i - 1) * th + bh; | |
- else | |
- c->y = sy + bh; | |
- if(stackpos == StackRight) | |
- c->x += master; | |
- else if(stackpos == StackBottom) | |
- c->y += master; | |
c->w = tw - 2 * BORDERPX; | |
c->h = th - 2 * BORDERPX; | |
- if(i + 1 == n) { /* fixes for last tile to tak… | |
- if(isvertical) | |
- c->h = sh - c->y - 2 * BORDERP… | |
+ switch(stackpos) { | |
+ case StackLeft: | |
+ if(isvertical) { | |
+ c->x = sx; | |
+ c->y = sy + (i - 1) * th + bh; | |
+ if(i + 1 == n) | |
+ c->h = sh - c->y - 2 *… | |
+ } | |
else { | |
- if(stackpos == StackLeft) | |
- c->w = master - c->x -… | |
- else | |
+ c->x = sx + (i - 1) * tw; | |
+ c->y = sy + bh; | |
+ if(i + 1 == n) | |
+ c->w = sx + stackw - c… | |
+ } | |
+ break; | |
+ case StackBottom: | |
+ if(isvertical) { | |
+ c->x = sx; | |
+ c->y = sy + master + (i - 1) *… | |
+ if(i + 1 == n) | |
+ c->h = sh - c->y - 2 *… | |
+ } | |
+ else { | |
+ c->x = sx + (i - 1) * tw; | |
+ c->y = sy + bh + master; | |
+ if(i + 1 == n) | |
c->w = sw - c->x - 2 *… | |
} | |
+ break; | |
+ case StackRight: | |
+ if(isvertical) { | |
+ c->x = sx + master; | |
+ c->y = sy + (i - 1) * th + bh; | |
+ if(i + 1 == n) | |
+ c->h = sh - c->y - 2 *… | |
+ } | |
+ else { | |
+ c->x = sx + master + (i - 1) *… | |
+ c->y = sy + bh; | |
+ if(i + 1 == n) | |
+ c->w = sx + stackw - c… | |
+ } | |
+ break; | |
} | |
} | |
else { /* fallback if th < bh resp. tw < MINW */ | |
- c->x = sx; | |
- c->y = sy + bh; | |
- if(stackpos == StackRight) | |
- c->x += master; | |
- else if(stackpos == StackBottom) | |
- c->y += master; | |
c->w = stackw - 2 * BORDERPX; | |
c->h = stackh - 2 * BORDERPX; | |
+ switch(stackpos) { | |
+ case StackLeft: | |
+ c->x = sx; | |
+ c->y = sy + bh; | |
+ break; | |
+ case StackBottom: | |
+ c->x = sx; | |
+ c->y = sy + master; | |
+ break; | |
+ case StackRight: | |
+ c->x = sx + master; | |
+ c->y = sy + bh; | |
+ break; | |
+ } | |
} | |
resize(c, False, TopLeft); | |
i++; | |
t@@ -319,6 +360,31 @@ toggleview(Arg *arg) { | |
} | |
void | |
+togglestackdir(Arg *arg) { | |
+ if(arrange == dofloat) | |
+ return; | |
+ isvertical = !isvertical; | |
+ arrange(NULL); | |
+} | |
+ | |
+void | |
+togglestackpos(Arg *arg) { | |
+ if(arrange == dofloat) | |
+ return; | |
+ if(stackpos == StackBottom) | |
+ stackpos = STACKPOS; | |
+ else | |
+ stackpos = StackBottom; | |
+ updatemaster(); | |
+ arrange(NULL); | |
+} | |
+ | |
+void | |
+updatemaster(void) { | |
+ master = ((stackpos == StackBottom ? sh - bh : sw) * MASTER) / 100; | |
+} | |
+ | |
+void | |
view(Arg *arg) { | |
unsigned int i; | |
t@@ -339,6 +405,8 @@ viewall(Arg *arg) { | |
arrange(NULL); | |
} | |
+ | |
+ | |
void | |
zoom(Arg *arg) { | |
unsigned int n; |