dwm-flexipatch/patch/deck.c

66 lines
1.6 KiB
C
Raw Normal View History

2019-09-09 16:00:02 +00:00
static void
deck(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, sfacts;
int mrest, srest;
2019-09-09 16:00:02 +00:00
Client *c;
#if VANITYGAPS_PATCH
2019-09-09 16:00:02 +00:00
int oh, ov, ih, iv;
getgaps(m, &oh, &ov, &ih, &iv, &n);
#else
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
#endif // VANITYGAPS_PATCH
2019-09-09 16:00:02 +00:00
if (n == 0)
return;
#if VANITYGAPS_PATCH
2019-09-09 16:00:02 +00:00
sx = mx = m->wx + ov;
sy = my = m->wy + oh;
sh = mh = m->wh - 2*oh - ih * (MIN(n, m->nmaster) - 1);
sw = mw = m->ww - 2*ov;
if (m->nmaster && n > m->nmaster) {
sw = (mw - iv) * (1 - m->mfact);
mw = (mw - iv) * m->mfact;
sx = mx + mw + iv;
sh = m->wh - 2*oh;
}
#else
2019-09-09 16:00:02 +00:00
sx = mx = m->wx;
sy = my = m->wy;
sh = mh = m->wh;
sw = mw = m->ww;
if (m->nmaster && n > m->nmaster) {
sw = mw * (1 - m->mfact);
mw = mw * m->mfact;
sx = mx + mw;
}
#endif // VANITYGAPS_PATCH
2019-09-09 16:00:02 +00:00
getfacts(m, mh, sh, &mfacts, &sfacts, &mrest, &srest);
2019-09-09 16:00:02 +00:00
if (n - m->nmaster > 0) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", n - m->nmaster);
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
#if CFACTS_PATCH
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), 0);
#else
resize(c, mx, my, mw - (2*c->bw), (mh / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), 0);
#endif // CFACTS_PATCH
#if VANITYGAPS_PATCH
my += HEIGHT(c) + ih;
#else
2019-09-09 16:00:02 +00:00
my += HEIGHT(c);
#endif
2019-09-09 16:00:02 +00:00
} else {
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
}
}