sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

bstackhoriz.c (824B)


      1 static void
      2 bstackhoriz(Monitor *m) {
      3 	int x, y, h, w, mh;
      4 	unsigned int i, n;
      5 	Client *c;
      6 
      7 	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
      8 	if(n == 0)
      9 		return;
     10 	/* master */
     11 	c = nexttiled(m->clients);
     12 	mh = m->mfact * m->wh;
     13 	resize(c, m->wx, m->wy, m->ww - 2 * c->bw, (n == 1 ? m->wh : mh) - 2 * c->bw, False);
     14 	if(--n == 0)
     15 		return;
     16 	/* tile stack */
     17 	x = m->wx;
     18 	y = (m->wy + mh > c->y + c->h) ? c->y + c->h + 2 * c->bw : m->wy + mh;
     19 	w = m->ww;
     20 	h = (m->wy + mh > c->y + c->h) ? m->wy + m->wh - y : m->wh - mh;
     21 	h /= n;
     22 	if(h < bh)
     23 		h = m->wh;
     24 	for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
     25 		resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n)
     26 		       ? m->wy + m->wh - y - 2 * c->bw : h - 2 * c->bw), False);
     27 		if(h != m->wh)
     28 			y = c->y + HEIGHT(c);
     29 	}
     30 }