removed tileh, renamed tilev into tile again, removed counttiles, tilemaster 42c4b310
Anselm R Garbe · 2008-05-17 14:23 2 file(s) · +15 −57
config.def.h +1 −1
25 25
26 26
Layout layouts[] = {
27 27
	/* symbol     function */
28 -
	{ "[]=",      tilev   }, /* first entry is default */
28 +
	{ "[]=",      tile    }, /* first entry is default */
29 29
	{ "><>",      NULL    }, /* no layout function means floating behavior */
30 30
	{ "<M>",      monocle }, /* TODO: remove this */
31 31
};
dwm.c +14 −56
119 119
void configure(Client *c);
120 120
void configurenotify(XEvent *e);
121 121
void configurerequest(XEvent *e);
122 -
unsigned int counttiled(void);
123 122
void destroynotify(XEvent *e);
124 123
void detach(Client *c);
125 124
void detachstack(Client *c);
168 167
void tag(const char *arg);
169 168
unsigned int textnw(const char *text, unsigned int len);
170 169
unsigned int textw(const char *text);
171 -
void tileh(void);
172 -
void tilehstack(unsigned int n);
173 -
Client *tilemaster(unsigned int n);
174 170
void tileresize(Client *c, int x, int y, int w, int h);
175 -
void tilev(void);
176 -
void tilevstack(unsigned int n);
171 +
void tile(void);
177 172
void togglefloating(const char *arg);
178 173
void togglelayout(const char *arg);
179 174
void toggletag(const char *arg);
466 461
		XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
467 462
	}
468 463
	XSync(dpy, False);
469 -
}
470 -
471 -
unsigned int
472 -
counttiled(void) {
473 -
	unsigned int n;
474 -
	Client *c;
475 -
476 -
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++);
477 -
	return n;
478 464
}
479 465
480 466
void
1508 1494
}
1509 1495
1510 1496
void
1511 -
tileh(void) {
1512 -
	int x, w;
1513 -
	unsigned int i, n = counttiled();
1514 -
	Client *c;
1515 -
1516 -
	if(n == 0)
1517 -
		return;
1518 -
	c = tilemaster(n);
1519 -
	if(--n == 0)
1520 -
		return;
1521 -
1522 -
	x = tx;
1523 -
	w = tw / n;
1524 -
	if(w < bh)
1525 -
		w = tw;
1526 -
1527 -
	for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) {
1528 -
		if(i + 1 == n) /* remainder */
1529 -
			tileresize(c, x, ty, (tx + tw) - x - 2 * c->bw, th - 2 * c->bw);
1530 -
		else
1531 -
			tileresize(c, x, ty, w - 2 * c->bw, th - 2 * c->bw);
1532 -
		if(w != tw)
1533 -
			x = c->x + c->w + 2 * c->bw;
1534 -
	}
1535 -
}
1536 -
1537 -
Client *
1538 -
tilemaster(unsigned int n) {
1539 -
	Client *c = nexttiled(clients);
1540 -
1541 -
	if(n == 1)
1542 -
		tileresize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw);
1543 -
	else
1544 -
		tileresize(c, mx, my, mw - 2 * c->bw, mh - 2 * c->bw);
1545 -
	return c;
1546 -
}
1547 -
1548 -
void
1549 1497
tileresize(Client *c, int x, int y, int w, int h) {
1550 1498
	resize(c, x, y, w, h, RESIZEHINTS);
1551 1499
	if((RESIZEHINTS) && ((c->h < bh) || (c->h > h) || (c->w < bh) || (c->w > w)))
1554 1502
}
1555 1503
1556 1504
void
1557 -
tilev(void) {
1505 +
tile(void) {
1558 1506
	int y, h;
1559 -
	unsigned int i, n = counttiled();
1507 +
	unsigned int i, n;
1560 1508
	Client *c;
1561 1509
1510 +
	for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++);
1562 1511
	if(n == 0)
1563 1512
		return;
1564 -
	c = tilemaster(n);
1513 +
1514 +
	/* master */
1515 +
	c = nexttiled(clients);
1516 +
1517 +
	if(n == 1)
1518 +
		tileresize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw);
1519 +
	else
1520 +
		tileresize(c, mx, my, mw - 2 * c->bw, mh - 2 * c->bw);
1521 +
1565 1522
	if(--n == 0)
1566 1523
		return;
1567 1524
1525 +
	/* tile stack */
1568 1526
	y = ty;
1569 1527
	h = th / n;
1570 1528
	if(h < bh)