diff options
| author | Anselm R Garbe <garbeam@gmail.com> | 2008-05-17 14:23:05 +0100 |
|---|---|---|
| committer | Anselm R Garbe <garbeam@gmail.com> | 2008-05-17 14:23:05 +0100 |
| commit | 42c4b310032ca6f54cdc861d74369b6373d0c33e (patch) | |
| tree | 79b0b72c02cd486f251a0c23ab7390e3b49a8f7a /dwm.c | |
| parent | removed Layout->isfloating (diff) | |
| download | dwm-42c4b310032ca6f54cdc861d74369b6373d0c33e.tar.gz dwm-42c4b310032ca6f54cdc861d74369b6373d0c33e.zip | |
removed tileh, renamed tilev into tile again, removed counttiles, tilemaster
Diffstat (limited to '')
| -rw-r--r-- | dwm.c | 70 |
1 files changed, 14 insertions, 56 deletions
| @@ -119,7 +119,6 @@ void cleanup(void); | |||
| 119 | void configure(Client *c); | 119 | void configure(Client *c); |
| 120 | void configurenotify(XEvent *e); | 120 | void configurenotify(XEvent *e); |
| 121 | void configurerequest(XEvent *e); | 121 | void configurerequest(XEvent *e); |
| 122 | unsigned int counttiled(void); | ||
| 123 | void destroynotify(XEvent *e); | 122 | void destroynotify(XEvent *e); |
| 124 | void detach(Client *c); | 123 | void detach(Client *c); |
| 125 | void detachstack(Client *c); | 124 | void detachstack(Client *c); |
| @@ -168,12 +167,8 @@ void spawn(const char *arg); | |||
| 168 | void tag(const char *arg); | 167 | void tag(const char *arg); |
| 169 | unsigned int textnw(const char *text, unsigned int len); | 168 | unsigned int textnw(const char *text, unsigned int len); |
| 170 | unsigned int textw(const char *text); | 169 | unsigned int textw(const char *text); |
| 171 | void tileh(void); | ||
| 172 | void tilehstack(unsigned int n); | ||
| 173 | Client *tilemaster(unsigned int n); | ||
| 174 | void tileresize(Client *c, int x, int y, int w, int h); | 170 | void tileresize(Client *c, int x, int y, int w, int h); |
| 175 | void tilev(void); | 171 | void tile(void); |
| 176 | void tilevstack(unsigned int n); | ||
| 177 | void togglefloating(const char *arg); | 172 | void togglefloating(const char *arg); |
| 178 | void togglelayout(const char *arg); | 173 | void togglelayout(const char *arg); |
| 179 | void toggletag(const char *arg); | 174 | void toggletag(const char *arg); |
| @@ -468,15 +463,6 @@ configurerequest(XEvent *e) { | |||
| 468 | XSync(dpy, False); | 463 | XSync(dpy, False); |
| 469 | } | 464 | } |
| 470 | 465 | ||
| 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 | } | ||
| 479 | |||
| 480 | void | 466 | void |
| 481 | destroynotify(XEvent *e) { | 467 | destroynotify(XEvent *e) { |
| 482 | Client *c; | 468 | Client *c; |
| @@ -1508,44 +1494,6 @@ textw(const char *text) { | |||
| 1508 | } | 1494 | } |
| 1509 | 1495 | ||
| 1510 | void | 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 | tileresize(Client *c, int x, int y, int w, int h) { | 1497 | tileresize(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 | ||
| 1556 | void | 1504 | void |
| 1557 | tilev(void) { | 1505 | tile(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) |
