From d7b074fcce4877ed404f6a92671689fcdee9133b Mon Sep 17 00:00:00 2001 From: Anselm R Garbe Date: Thu, 6 Mar 2008 19:20:14 +0000 Subject: new stuff --- dwm.c | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 2985cea..f51d801 100644 --- a/dwm.c +++ b/dwm.c @@ -1,6 +1,3 @@ -/** - * - allow for vstack - */ /* See LICENSE file for copyright and license details. * * dynamic window manager is designed like any other X client as well. It is @@ -36,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -170,8 +166,10 @@ void spawn(const char *arg); void tag(const char *arg); unsigned int textnw(const char *text, unsigned int len); unsigned int textw(const char *text); -void tile(void); +void tileh(void); +void tilehstack(unsigned int n); unsigned int tilemaster(void); +void tilev(void); void tilevstack(unsigned int n); void togglefloating(const char *arg); void toggletag(const char *arg); @@ -1547,6 +1545,37 @@ tileresize(Client *c, int x, int y, int w, int h) { resize(c, x, y, w, h, False); } +void +tileh(void) { + tilehstack(tilemaster()); +} + +void +tilehstack(unsigned int n) { + int i, x, w; + Client *c; + + if(n == 0) + return; + + x = TX; + w = (TW) / n; + if(w < bh) + w = TW; + + for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) + if(i > 0) { + if(i > 1 && i == n) /* remainder */ + tileresize(c, x, TY, ((TX) + (TW)) - x - 2 * c->border, + TH - 2 * c->border); + else + tileresize(c, x, TY, w - 2 * c->border, + TH - 2 * c->border); + if(w != TW) + x = c->x + c->w + 2 * c->border; + } +} + unsigned int tilemaster(void) { unsigned int n; @@ -1563,6 +1592,11 @@ tilemaster(void) { return n - 1; } +void +tilev(void) { + tilevstack(tilemaster()); +} + void tilevstack(unsigned int n) { int i, y, h; @@ -1589,11 +1623,6 @@ tilevstack(unsigned int n) { } } -void -tile(void) { - tilevstack(tilemaster()); -} - void togglefloating(const char *arg) { if(!sel) -- cgit v1.2.3-54-g00ecf