Hi there,

> And I can say that for xinerama we will probably need to adapt it to
> support also vertical tiling. Using horitzontal it's mostly a waste of
> space on big screens.

Yes, I think you are right. Furthermore, horizontal tiling (Anselm's notation) 
could be useful for some other geoms (eg "bottom").

> I would like to see something like vntile and hntile or just a toggle for
> it. What do you think about this?

It is a good idea. In the patch there are now four layouts called:
        "-|=", ntilevv
        "-||", ntilevh
        "||=", ntilehv
        "|||", ntilehh
to fit all the cases: 2 small screens, 2 big screens, 1 small and/or 1 big 
screen. People can safely remove from the patch those ones they don't 
need.

I hope it was what you were thinking about :).

Kind regards,
Nibble
int nmaster = NMASTER;

void
ntilevv(void) {
	unsigned int i, n = counttiled(), lnx, lny, lnw, lnh, lmah, lmw, lmh, lth;
	Client *c;

	/* window geoms */
	lmah = (n <= nmaster) ? moh : mh;
	lmh = (n <= nmaster) ? lmah / (n > 0 ? n : 1) : lmah / nmaster;
	lmw = (n <= nmaster) ? mow : mw;
	lth = (n > nmaster) ? th / (n - nmaster) : 0;

	for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
		if(i < nmaster) { /* master */
			lnx = mx;
			lny = my + i * lmh;
			lnw = lmw - 2 * c->bw;
			lnh = lmh;
			if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */
				lnh = lmah - lmh * i;
			lnh -= 2 * c->bw;
		}
		else {  /* tile window */
			if(i == nmaster) {
				lny = ty;
				lnx = tx;
			}
			lnw = tw - 2 * c->bw;
			if(i + 1 == n) /* remainder */
				lnh = (ty + th) - lny;
			else
				lnh = lth;
			lnh -= 2 * c->bw;
		}
		tileresize(c, lnx, lny, lnw, lnh);
		if(n > nmaster && lth != th)
			lny += lnh + 2 * c->bw;
	}
}

void
ntilevh(void) {
	unsigned int i, n = counttiled(), lnx, lny, lnw, lnh, lmah, lmw, lmh, ltw;
	Client *c;

	/* window geoms */
	lmah = (n <= nmaster) ? moh : mh;
	lmh = (n <= nmaster) ? lmah / (n > 0 ? n : 1) : lmah / nmaster;
	lmw = (n <= nmaster) ? mow : mw;
	ltw = (n > nmaster) ? tw / (n - nmaster) : 0;

	for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
		if(i < nmaster) { /* master */
			lnx = mx;
			lny = my + i * lmh;
			lnw = lmw - 2 * c->bw;
			lnh = lmh;
			if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */
				lnh = lmah - lmh * i;
			lnh -= 2 * c->bw;
		}
		else {  /* tile window */
			if(i == nmaster) {
				lny = ty;
				lnx = tx;
			}
			lnh = th - 2 * c->bw;
			if(i + 1 == n) /* remainder */
				lnw = (tx + tw) - lnx;
			else
				lnw = ltw;
			lnw -= 2 * c->bw;
		}
		tileresize(c, lnx, lny, lnw, lnh);
		if(n > nmaster && ltw != tw)
			lnx += lnw + 2 * c->bw;
	}
}

void
ntilehv(void) {
	unsigned int i, n = counttiled(), lnx, lny, lnw, lnh, lmaw, lmw, lmh, lth;
	Client *c;

	/* window geoms */
	lmh = (n <= nmaster) ? moh : mh;
	lmaw = (n <= nmaster) ? mow : mw;
	lmw = (n <= nmaster) ? lmaw / (n > 0 ? n : 1) : lmaw / nmaster;
	lth = (n > nmaster) ? th / (n - nmaster) : 0;

	for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
		if(i < nmaster) { /* master */
			lnx = mx + i * lmw;
			lny = my;
			lnw = lmw;
			lnh = lmh - 2 * c->bw;
			if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */
				lnw = lmaw - lmw * i;
			lnw -= 2 * c->bw;
		}
		else {  /* tile window */
			if(i == nmaster) {
				lny = ty;
				lnx = tx;
			}
			lnw = tw - 2 * c->bw;
			if(i + 1 == n) /* remainder */
				lnh = (ty + th) - lny;
			else
				lnh = lth;
			lnh -= 2 * c->bw;
		}
		tileresize(c, lnx, lny, lnw, lnh);
		if(n > nmaster && lth != th)
			lny += lnh + 2 * c->bw;
	}
}

void
ntilehh(void) {
	unsigned int i, n = counttiled(), lnx, lny, lnw, lnh, lmaw, lmw, lmh, ltw;
	Client *c;

	/* window geoms */
	lmh = (n <= nmaster) ? moh : mh;
	lmaw = (n <= nmaster) ? mow : mw;
	lmw = (n <= nmaster) ? lmaw / (n > 0 ? n : 1) : lmaw / nmaster;
	ltw = (n > nmaster) ? tw / (n - nmaster) : 0;

	for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
		if(i < nmaster) { /* master */
			lnx = mx + i * lmw;
			lny = my;
			lnw = lmw;
			lnh = lmh - 2 * c->bw;
			if(i + 1 == (n < nmaster ? n : nmaster)) /* remainder */
				lnw = lmaw - lmw * i;
			lnw -= 2 * c->bw;
		}
		else {  /* tile window */
			if(i == nmaster) {
				lny = ty;
				lnx = tx;
			}
			lnh = th - 2 * c->bw;
			if(i + 1 == n) /* remainder */
				lnw = (tx + tw) - lnx;
			else
				lnw = ltw;
			lnw -= 2 * c->bw;
		}
		tileresize(c, lnx, lny, lnw, lnh);
		if(n > nmaster && ltw != tw)
			lnx += lnw + 2 * c->bw;
	}
}

void
setnmaster(const char *arg) {
	int i;

	if(!arg)
		nmaster = NMASTER;
	else {
		i = atoi(arg);
		if((nmaster + i) < 1 || wh / (nmaster + i) <= 2 * BORDERPX)
			return;
		nmaster += i;
	}
	if(sel)
		arrange();
}

Reply via email to