2022-10-31 13:25:39 +00:00
|
|
|
#include "../dwm.h"
|
|
|
|
#include "../util.h"
|
|
|
|
|
2022-07-10 18:29:52 +00:00
|
|
|
void
|
2022-10-31 13:25:39 +00:00
|
|
|
tile(Monitor *m) {
|
|
|
|
unsigned int i, n, h, mw, my, ty;
|
|
|
|
Client *c;
|
2022-07-10 18:29:52 +00:00
|
|
|
|
2022-10-31 13:25:39 +00:00
|
|
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
|
|
|
if (n == 0)
|
|
|
|
return;
|
2022-07-10 18:29:52 +00:00
|
|
|
|
2022-10-31 13:25:39 +00:00
|
|
|
if (n > m->nmaster)
|
|
|
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
|
|
|
else
|
|
|
|
mw = m->ww;
|
|
|
|
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
|
|
|
if (i < m->nmaster) {
|
|
|
|
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
|
|
|
|
resize(c, m->wx, m->wy + my, mw - (2 * c->bw), h - (2 * c->bw), 0);
|
|
|
|
if (my + HEIGHT(c) < m->wh)
|
|
|
|
my += HEIGHT(c);
|
|
|
|
} else {
|
|
|
|
h = (m->wh - ty) / (n - i);
|
|
|
|
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2 * c->bw), h - (2 * c->bw), 0);
|
|
|
|
if (ty + HEIGHT(c) < m->wh)
|
|
|
|
ty += HEIGHT(c);
|
|
|
|
}
|
2022-07-10 18:29:52 +00:00
|
|
|
}
|