mirror of
https://github.com/bakkeby/dwm-flexipatch
synced 2024-11-09 01:10:26 +00:00
152 lines
3.5 KiB
C
152 lines
3.5 KiB
C
#if VANITYGAPS_PATCH && CFACTS_PATCH
|
|
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;
|
|
int oh, ov, ih, iv;
|
|
float mfacts, sfacts;
|
|
Client *c;
|
|
|
|
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
|
getfacts(m, &mfacts, &sfacts);
|
|
|
|
if (n == 0)
|
|
return;
|
|
|
|
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;
|
|
}
|
|
|
|
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) {
|
|
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) - (2*c->bw), 0);
|
|
my += HEIGHT(c) + ih;
|
|
} else {
|
|
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
|
}
|
|
}
|
|
#elif VANITYGAPS_PATCH
|
|
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;
|
|
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 - 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;
|
|
}
|
|
|
|
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) {
|
|
resize(c, mx, my, mw - (2*c->bw), mh / MIN(n, m->nmaster) - (2*c->bw), 0);
|
|
my += HEIGHT(c) + ih;
|
|
} else {
|
|
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
|
}
|
|
}
|
|
#elif CFACTS_PATCH
|
|
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;
|
|
Client *c;
|
|
|
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
if (n == 0)
|
|
return;
|
|
|
|
getfacts(m, &mfacts, &sfacts);
|
|
|
|
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;
|
|
}
|
|
|
|
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) {
|
|
resize(c, mx, my, mw - (2*c->bw), mh * (c->cfact / mfacts) - (2*c->bw), 0);
|
|
my += HEIGHT(c);
|
|
} else {
|
|
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
|
}
|
|
}
|
|
#else
|
|
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;
|
|
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) {
|
|
sw = mw * (1 - m->mfact);
|
|
mw = mw * m->mfact;
|
|
sx = mx + mw;
|
|
}
|
|
|
|
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) {
|
|
resize(c, mx, my, mw - (2*c->bw), mh / MIN(n, m->nmaster) - (2*c->bw), 0);
|
|
my += HEIGHT(c);
|
|
} else {
|
|
resize(c, sx, sy, sw - (2*c->bw), sh - (2*c->bw), 0);
|
|
}
|
|
}
|
|
#endif |