Add gaps to gaplessgrid
This commit is contained in:
parent
1b96862ae2
commit
645882cc94
|
@ -41,7 +41,6 @@ monocle(Monitor *m)
|
|||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
}
|
||||
|
||||
// TODO: Add gaps
|
||||
void
|
||||
gaplessgrid(Monitor *m) {
|
||||
unsigned int n, cols, rows, cn, rn, i, cx, cy, cw, ch;
|
||||
|
@ -60,16 +59,16 @@ gaplessgrid(Monitor *m) {
|
|||
rows = n/cols;
|
||||
|
||||
/* window geometries */
|
||||
cw = cols ? m->ww / cols : m->ww;
|
||||
cw = cols ? (m->ww - gappx) / cols : m->ww - gappx;
|
||||
cn = 0; /* current column number */
|
||||
rn = 0; /* current row number */
|
||||
for(i = 0, c = nexttiled(m->clients); c; i++, c = nexttiled(c->next)) {
|
||||
if(i/rows + 1 > cols - n%cols)
|
||||
rows = n/cols + 1;
|
||||
ch = rows ? m->wh / rows : m->wh;
|
||||
ch = rows ? (m->wh - gappx) / rows : m->wh - gappx;
|
||||
cx = m->wx + cn*cw;
|
||||
cy = m->wy + rn*ch;
|
||||
resize(c, cx, cy, cw - 2 * c->bw, ch - 2 * c->bw, False);
|
||||
resize(c, cx + gappx, cy + gappx, cw - 2 * c->bw - gappx, ch - 2 * c->bw - gappx, False);
|
||||
rn++;
|
||||
if(rn >= rows) {
|
||||
rn = 0;
|
||||
|
|
Loading…
Reference in New Issue