2019-09-09 19:35:19 +00:00
|
|
|
void
|
|
|
|
centeredfloatingmaster(Monitor *m)
|
|
|
|
{
|
|
|
|
unsigned int i, n;
|
2020-03-20 14:20:07 +00:00
|
|
|
float mfacts, sfacts;
|
|
|
|
int mrest, srest;
|
2019-09-09 19:35:19 +00:00
|
|
|
int mx = 0, my = 0, mh = 0, mw = 0;
|
|
|
|
int sx = 0, sy = 0, sh = 0, sw = 0;
|
|
|
|
Client *c;
|
|
|
|
|
2020-03-20 14:20:07 +00:00
|
|
|
#if VANITYGAPS_PATCH
|
|
|
|
float mivf = 1.0; // master inner vertical gap factor
|
2019-09-09 19:35:19 +00:00
|
|
|
int oh, ov, ih, iv;
|
|
|
|
getgaps(m, &oh, &ov, &ih, &iv, &n);
|
2020-03-20 14:20:07 +00:00
|
|
|
#else
|
|
|
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
|
|
#endif // VANITYGAPS_PATCH
|
2019-09-09 19:35:19 +00:00
|
|
|
|
|
|
|
if (n == 0)
|
|
|
|
return;
|
|
|
|
|
2020-03-20 14:20:07 +00:00
|
|
|
#if VANITYGAPS_PATCH
|
2019-09-09 19:35:19 +00:00
|
|
|
sx = mx = m->wx + ov;
|
|
|
|
sy = my = m->wy + oh;
|
|
|
|
sh = mh = m->wh - 2*oh;
|
2020-03-20 14:20:07 +00:00
|
|
|
mw = m->ww - 2*ov - iv*(n - 1);
|
|
|
|
sw = m->ww - 2*ov - iv*(n - m->nmaster - 1);
|
2019-09-09 19:35:19 +00:00
|
|
|
|
|
|
|
if (m->nmaster && n > m->nmaster) {
|
2020-03-20 14:20:07 +00:00
|
|
|
mivf = 0.8;
|
2019-09-09 19:35:19 +00:00
|
|
|
/* go mfact box in the center if more than nmaster clients */
|
|
|
|
if (m->ww > m->wh) {
|
|
|
|
mw = m->ww * m->mfact - iv*mivf*(MIN(n, m->nmaster) - 1);
|
|
|
|
mh = m->wh * 0.9;
|
|
|
|
} else {
|
|
|
|
mw = m->ww * 0.9 - iv*mivf*(MIN(n, m->nmaster) - 1);
|
|
|
|
mh = m->wh * m->mfact;
|
|
|
|
}
|
|
|
|
mx = m->wx + (m->ww - mw) / 2;
|
|
|
|
my = m->wy + (m->wh - mh - 2*oh) / 2;
|
|
|
|
|
|
|
|
sx = m->wx + ov;
|
|
|
|
sy = m->wy + oh;
|
|
|
|
sh = m->wh - 2*oh;
|
|
|
|
}
|
2020-03-20 14:20:07 +00:00
|
|
|
#else
|
2019-09-09 19:35:19 +00:00
|
|
|
sx = mx = m->wx;
|
|
|
|
sy = my = m->wy;
|
|
|
|
sh = mh = m->wh;
|
|
|
|
sw = mw = m->ww;
|
|
|
|
|
|
|
|
if (m->nmaster && n > m->nmaster) {
|
|
|
|
/* go mfact box in the center if more than nmaster clients */
|
|
|
|
if (m->ww > m->wh) {
|
|
|
|
mw = m->ww * m->mfact;
|
|
|
|
mh = m->wh * 0.9;
|
|
|
|
} else {
|
|
|
|
mw = m->ww * 0.9;
|
|
|
|
mh = m->wh * m->mfact;
|
|
|
|
}
|
|
|
|
mx = m->wx + (m->ww - mw) / 2;
|
|
|
|
my = m->wy + (m->wh - mh) / 2;
|
|
|
|
}
|
2020-03-20 14:20:07 +00:00
|
|
|
#endif // VANITYGAPS_PATCH
|
2019-09-09 19:35:19 +00:00
|
|
|
|
2020-03-20 14:20:07 +00:00
|
|
|
getfacts(m, mw, sw, &mfacts, &sfacts, &mrest, &srest);
|
2019-09-09 19:35:19 +00:00
|
|
|
|
2020-03-20 14:20:07 +00:00
|
|
|
for (i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
2019-09-09 19:35:19 +00:00
|
|
|
if (i < m->nmaster) {
|
|
|
|
/* nmaster clients are stacked horizontally, in the center of the screen */
|
2020-03-20 14:20:07 +00:00
|
|
|
#if CFACTS_PATCH
|
|
|
|
resize(c, mx, my, (mw / mfacts) * c->cfact + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
|
|
|
#else
|
|
|
|
resize(c, mx, my, (mw / mfacts) + (i < mrest ? 1 : 0) - (2*c->bw), mh - (2*c->bw), 0);
|
|
|
|
#endif // CFACTS_PATCH
|
|
|
|
#if VANITYGAPS_PATCH
|
|
|
|
mx += WIDTH(c) + iv*mivf;
|
|
|
|
#else
|
2019-09-09 19:35:19 +00:00
|
|
|
mx += WIDTH(c);
|
2020-03-20 14:20:07 +00:00
|
|
|
#endif
|
2019-09-09 19:35:19 +00:00
|
|
|
} else {
|
|
|
|
/* stack clients are stacked horizontally */
|
2020-03-20 14:20:07 +00:00
|
|
|
#if CFACTS_PATCH
|
2020-03-21 13:23:27 +00:00
|
|
|
resize(c, sx, sy, (sw / sfacts) * c->cfact + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
|
2020-03-20 14:20:07 +00:00
|
|
|
#else
|
2020-03-21 13:23:27 +00:00
|
|
|
resize(c, sx, sy, (sw / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), sh - (2*c->bw), 0);
|
2020-03-20 14:20:07 +00:00
|
|
|
#endif // CFACTS_PATCH
|
|
|
|
#if VANITYGAPS_PATCH
|
|
|
|
sx += WIDTH(c) + iv;
|
|
|
|
#else
|
2019-09-09 19:35:19 +00:00
|
|
|
sx += WIDTH(c);
|
2020-03-20 14:20:07 +00:00
|
|
|
#endif
|
2019-09-09 19:35:19 +00:00
|
|
|
}
|
2020-03-24 09:17:09 +00:00
|
|
|
}
|
2021-06-14 05:16:17 +00:00
|
|
|
|