diff options
Diffstat (limited to 'vanitygaps.c')
-rw-r--r-- | vanitygaps.c | 57 |
1 files changed, 45 insertions, 12 deletions
diff --git a/vanitygaps.c b/vanitygaps.c index 37867eb..a214e4c 100644 --- a/vanitygaps.c +++ b/vanitygaps.c @@ -8,6 +8,7 @@ static void incrovgaps(const Arg *arg); static void incrihgaps(const Arg *arg); static void incrivgaps(const Arg *arg); static void togglegaps(const Arg *arg); +static void tilewide(Monitor *m); /* Layouts (delete the ones you do not need) */ static void bstackhoriz(Monitor *m); static void centeredmaster(Monitor *m); @@ -16,11 +17,7 @@ static void tile(Monitor *m); static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc); static void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr); static void setgaps(int oh, int ov, int ih, int iv); - -/* Settings */ -#if !PERTAG_PATCH static int enablegaps = 1; -#endif // PERTAG_PATCH void setgaps(int oh, int ov, int ih, int iv) @@ -40,11 +37,7 @@ setgaps(int oh, int ov, int ih, int iv) void togglegaps(const Arg *arg) { - #if PERTAG_PATCH - selmon->pertag->enablegaps[selmon->pertag->curtag] = !selmon->pertag->enablegaps[selmon->pertag->curtag]; - #else enablegaps = !enablegaps; - #endif // PERTAG_PATCH arrange(NULL); } @@ -135,11 +128,7 @@ void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int *nc) { unsigned int n, oe, ie; - #if PERTAG_PATCH - oe = ie = selmon->pertag->enablegaps[selmon->pertag->curtag]; - #else oe = ie = enablegaps; - #endif // PERTAG_PATCH Client *c; for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); @@ -409,3 +398,47 @@ tile(Monitor *m) sy += HEIGHT(c) + ih; } } + + +void +tilewide(Monitor *m) +{ + unsigned int i, n; + int oh, ov, ih, iv; + int mx = 0, my = 0, fullmw = 0, mh = 0, mw = 0; + int sx = 0, sy = 0, sh = 0, sw = 0; + float mfacts, stacts; + int mrest, srest; + Client *c; + + getgaps(m, &oh, &ov, &ih, &iv, &n); + + if (n == 0) + return; + + sx = mx = m->wx + ov; + sy = my = m->wy + oh; + mh = m->wh - 2*oh; // Since master tiles horizontally + sh = m->wh - 2*oh - ih * (n - m->nmaster - 1); + fullmw = ((m->ww - 2*ov) * m->mfact); + sw = mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1); + + if (m->nmaster && n > m->nmaster) { + mw = fullmw - iv*(m->nmaster-1); + sx = mx + fullmw+iv; + sw = (m->ww - 2*ov) * (1-m->mfact); + } + + getfacts(m, mw, sw, &mfacts, &stacts, &mrest, &srest); + + for (i=0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { + if (i < m->nmaster) { + resize(c, mx, my, mw * (c->cfact / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0); + mx += WIDTH(c) + iv; + } else { + resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / stacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0); + sy += HEIGHT(c) + ih; + } + } + +} |