117 void checkotherwm(void); |
117 void checkotherwm(void); |
118 void cleanup(void); |
118 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); |
126 void drawbar(void); |
125 void drawbar(void); |
127 void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); |
126 void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); |
166 void setup(void); |
165 void setup(void); |
167 void spawn(const char *arg); |
166 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); |
180 void toggleview(const char *arg); |
175 void toggleview(const char *arg); |
181 void unban(Client *c); |
176 void unban(Client *c); |
1506 textw(const char *text) { |
1492 textw(const char *text) { |
1507 return textnw(text, strlen(text)) + dc.font.height; |
1493 return textnw(text, strlen(text)) + dc.font.height; |
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))) |
1552 /* client doesn't accept size constraints */ |
1500 /* client doesn't accept size constraints */ |
1553 resize(c, x, y, w, h, False); |
1501 resize(c, x, y, w, h, False); |
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) |
1571 h = th; |
1529 h = th; |
1572 |
1530 |