X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=f51d801d8394b30498be2bcc8047a984c691133f;hp=2985ceabc4fd600514b2b0b2741fca532371a665;hb=d7b074fcce4877ed404f6a92671689fcdee9133b;hpb=c9170189bf0d0234f8d97fd7b717f859b7242674 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; @@ -1564,6 +1593,11 @@ tilemaster(void) { } void +tilev(void) { + tilevstack(tilemaster()); +} + +void tilevstack(unsigned int n) { int i, y, h; Client *c; @@ -1590,11 +1624,6 @@ tilevstack(unsigned int n) { } void -tile(void) { - tilevstack(tilemaster()); -} - -void togglefloating(const char *arg) { if(!sel) return;