improve tile spacing 2420071f
Connor Lane Smith · 2011-10-28 23:45 1 file(s) · +12 −9
dwm.c +12 −9
1659 1659
1660 1660
void
1661 1661
tile(Monitor *m) {
1662 -
	unsigned int i, n, mw, mh, tw, th;
1662 +
	unsigned int i, n, h, mw, my, ty;
1663 1663
	Client *c;
1664 1664
1665 1665
	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
1666 1666
	if(n == 0)
1667 1667
		return;
1668 1668
1669 -
	mh = (n > m->nmaster) ? m->wh / m->nmaster : m->wh / n;
1670 1669
	mw = (n > m->nmaster) ? m->ww * m->mfact : m->ww;
1671 -
	th = (n > m->nmaster) ? m->wh / (n - m->nmaster) : 0;
1672 -
	tw = m->ww - mw;
1673 1670
1674 -
	for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
1675 -
		if(i < m->nmaster)
1676 -
			resize(c, m->wx, m->wy + (i*mh), mw - (2*c->bw), mh - (2*c->bw), False);
1677 -
		else
1678 -
			resize(c, m->wx + mw, m->wy + ((i - m->nmaster)*th), tw - (2*c->bw), th - (2*c->bw), False);
1671 +
	for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
1672 +
		if(i < m->nmaster) {
1673 +
			h = (m->wh - my) / (MIN(n, m->nmaster) - i);
1674 +
			resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
1675 +
			my += HEIGHT(c);
1676 +
		}
1677 +
		else {
1678 +
			h = (m->wh - ty) / (n - i);
1679 +
			resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
1680 +
			ty += HEIGHT(c);
1681 +
		}
1679 1682
}
1680 1683
1681 1684
void