diff options
| author | bakkeby <[email protected]> | 2019-09-09 00:18:47 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2019-09-09 00:18:47 +0200 |
| commit | e490af0eb2d24e94af67c934e6ae05246ee7c885 (patch) | |
| tree | 7784227501f1bc5f20a308cafcd6573450413cd5 /patch/bstackhoriz.c | |
| parent | 747512af21fabae327a1a4e7b01bfd00af8eeb15 (diff) | |
| download | dwm-flexipatch-e490af0eb2d24e94af67c934e6ae05246ee7c885.tar.gz dwm-flexipatch-e490af0eb2d24e94af67c934e6ae05246ee7c885.zip | |
Adding cfacts, vanitygaps patches and bottomstack layouts
Diffstat (limited to 'patch/bstackhoriz.c')
| -rw-r--r-- | patch/bstackhoriz.c | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/patch/bstackhoriz.c b/patch/bstackhoriz.c new file mode 100644 index 0000000..3a4d11a --- /dev/null +++ b/patch/bstackhoriz.c @@ -0,0 +1,155 @@ +#if VANITYGAPS_PATCH && CFACTS_PATCH +static void +bstackhoriz(Monitor *m) +{ + unsigned int i, n; + int mx = 0, my = 0, mh = 0, mw = 0; + int sx = 0, sy = 0, sh = 0, sw = 0; + int oh, ov, ih, iv; + float mfacts, sfacts; + Client *c; + + getgaps(m, &oh, &ov, &ih, &iv, &n, &mfacts, &sfacts); + + if (n == 0) + return; + + sx = mx = m->wx + ov; + sy = my = m->wy + oh; + sh = mh = m->wh - 2*oh; + sw = mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1); + + if (m->nmaster && n > m->nmaster) { + sh = (mh - ih) * (1 - m->mfact); + mh = (mh - ih) * m->mfact; + sy = my + mh + ih; + sh = m->wh - mh - 2*oh - ih * (n - m->nmaster); + sw = m->ww - 2*ov; + } + + 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) - (2*c->bw), mh - (2*c->bw), 0); + mx += WIDTH(c) + iv; + } else { + resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) - (2*c->bw), 0); + sy += HEIGHT(c) + ih; + } + } +} +#elif VANITYGAPS_PATCH +static void +bstackhoriz(Monitor *m) +{ + unsigned int i, n; + int mx = 0, my = 0, mh = 0, mw = 0; + int sx = 0, sy = 0, sh = 0, sw = 0; + int oh, ov, ih, iv; + Client *c; + + getgaps(m, &oh, &ov, &ih, &iv, &n); + + if (n == 0) + return; + + sx = mx = m->wx + ov; + sy = my = m->wy + oh; + sh = mh = m->wh - 2*oh; + sw = mw = m->ww - 2*ov - iv * (MIN(n, m->nmaster) - 1); + + if (m->nmaster && n > m->nmaster) { + sh = (mh - ih) * (1 - m->mfact); + mh = (mh - ih) * m->mfact; + sy = my + mh + ih; + sh = m->wh - mh - 2*oh - ih * (n - m->nmaster); + sw = m->ww - 2*ov; + } + + for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { + if (i < m->nmaster) { + resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0); + mx += WIDTH(c) + iv; + } else { + resize(c, sx, sy, sw - (2*c->bw), sh / (n - MIN(n, m->nmaster)) - (2*c->bw), 0); + sy += HEIGHT(c) + ih; + } + } +} +#elif CFACTS_PATCH +static void +bstackhoriz(Monitor *m) +{ + unsigned int i, n; + int mx = 0, my = 0, mh = 0, mw = 0; + int sx = 0, sy = 0, sh = 0, sw = 0; + float mfacts = 1, sfacts = 1; + Client *c; + + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) { + if (n < m->nmaster) + mfacts += c->cfact; + else + sfacts += c->cfact; + } + + if (n == 0) + return; + + sx = mx = m->wx; + sy = my = m->wy; + sh = mh = m->wh; + sw = mw = m->ww; + + if (m->nmaster && n > m->nmaster) { + sh = mh * (1 - m->mfact); + mh = mh * m->mfact; + sy = my + mh; + sh = m->wh - mh; + } + + 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) - (2*c->bw), mh - (2*c->bw), 0); + mx += WIDTH(c); + } else { + resize(c, sx, sy, sw - (2*c->bw), sh * (c->cfact / sfacts) - (2*c->bw), 0); + sy += HEIGHT(c); + } + } +} +#else +static void +bstackhoriz(Monitor *m) +{ + unsigned int i, n; + int mx = 0, my = 0, mh = 0, mw = 0; + int sx = 0, sy = 0, sh = 0, sw = 0; + Client *c; + + for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if (n == 0) + return; + + sx = mx = m->wx; + sy = my = m->wy; + sh = mh = m->wh; + sw = mw = m->ww; + + if (m->nmaster && n > m->nmaster) { + sh = mh * (1 - m->mfact); + mh = mh * m->mfact; + sy = my + mh; + sh = m->wh - mh; + } + + for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { + if (i < m->nmaster) { + resize(c, mx, my, mw / MIN(n, m->nmaster) - (2*c->bw), mh - (2*c->bw), 0); + mx += WIDTH(c); + } else { + resize(c, sx, sy, sw - (2*c->bw), sh / (n - MIN(n, m->nmaster)) - (2*c->bw), 0); + sy += HEIGHT(c); + } + } +} +#endif
\ No newline at end of file |
