summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-05-17 14:23:05 +0100
committerAnselm R Garbe <garbeam@gmail.com>2008-05-17 14:23:05 +0100
commit42c4b310032ca6f54cdc861d74369b6373d0c33e (patch)
tree79b0b72c02cd486f251a0c23ab7390e3b49a8f7a /dwm.c
parentremoved Layout->isfloating (diff)
downloaddwm-42c4b310032ca6f54cdc861d74369b6373d0c33e.tar.gz
dwm-42c4b310032ca6f54cdc861d74369b6373d0c33e.zip
removed tileh, renamed tilev into tile again, removed counttiles, tilemaster
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c70
1 files changed, 14 insertions, 56 deletions
diff --git a/dwm.c b/dwm.c
index 3650ccd..25bc926 100644
--- a/dwm.c
+++ b/dwm.c
@@ -119,7 +119,6 @@ void cleanup(void);
119void configure(Client *c); 119void configure(Client *c);
120void configurenotify(XEvent *e); 120void configurenotify(XEvent *e);
121void configurerequest(XEvent *e); 121void configurerequest(XEvent *e);
122unsigned int counttiled(void);
123void destroynotify(XEvent *e); 122void destroynotify(XEvent *e);
124void detach(Client *c); 123void detach(Client *c);
125void detachstack(Client *c); 124void detachstack(Client *c);
@@ -168,12 +167,8 @@ void spawn(const char *arg);
168void tag(const char *arg); 167void tag(const char *arg);
169unsigned int textnw(const char *text, unsigned int len); 168unsigned int textnw(const char *text, unsigned int len);
170unsigned int textw(const char *text); 169unsigned int textw(const char *text);
171void tileh(void);
172void tilehstack(unsigned int n);
173Client *tilemaster(unsigned int n);
174void tileresize(Client *c, int x, int y, int w, int h); 170void tileresize(Client *c, int x, int y, int w, int h);
175void tilev(void); 171void tile(void);
176void tilevstack(unsigned int n);
177void togglefloating(const char *arg); 172void togglefloating(const char *arg);
178void togglelayout(const char *arg); 173void togglelayout(const char *arg);
179void toggletag(const char *arg); 174void toggletag(const char *arg);
@@ -468,15 +463,6 @@ configurerequest(XEvent *e) {
468 XSync(dpy, False); 463 XSync(dpy, False);
469} 464}
470 465
471unsigned int
472counttiled(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}
479
480void 466void
481destroynotify(XEvent *e) { 467destroynotify(XEvent *e) {
482 Client *c; 468 Client *c;
@@ -1508,44 +1494,6 @@ textw(const char *text) {
1508} 1494}
1509 1495
1510void 1496void
1511tileh(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
1537Client *
1538tilemaster(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
1548void
1549tileresize(Client *c, int x, int y, int w, int h) { 1497tileresize(Client *c, int x, int y, int w, int h) {
1550 resize(c, x, y, w, h, RESIZEHINTS); 1498 resize(c, x, y, w, h, RESIZEHINTS);
1551 if((RESIZEHINTS) && ((c->h < bh) || (c->h > h) || (c->w < bh) || (c->w > w))) 1499 if((RESIZEHINTS) && ((c->h < bh) || (c->h > h) || (c->w < bh) || (c->w > w)))
@@ -1554,17 +1502,27 @@ tileresize(Client *c, int x, int y, int w, int h) {
1554} 1502}
1555 1503
1556void 1504void
1557tilev(void) { 1505tile(void) {
1558 int y, h; 1506 int y, h;
1559 unsigned int i, n = counttiled(); 1507 unsigned int i, n;
1560 Client *c; 1508 Client *c;
1561 1509
1510 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++);
1562 if(n == 0) 1511 if(n == 0)
1563 return; 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 if(--n == 0) 1522 if(--n == 0)
1566 return; 1523 return;
1567 1524
1525 /* tile stack */
1568 y = ty; 1526 y = ty;
1569 h = th / n; 1527 h = th / n;
1570 if(h < bh) 1528 if(h < bh)