115 void checkotherwm(void); |
115 void checkotherwm(void); |
116 void cleanup(void); |
116 void cleanup(void); |
117 void configure(Client *c); |
117 void configure(Client *c); |
118 void configurenotify(XEvent *e); |
118 void configurenotify(XEvent *e); |
119 void configurerequest(XEvent *e); |
119 void configurerequest(XEvent *e); |
|
120 unsigned int counttiled(void); |
120 void destroynotify(XEvent *e); |
121 void destroynotify(XEvent *e); |
121 void detach(Client *c); |
122 void detach(Client *c); |
122 void detachstack(Client *c); |
123 void detachstack(Client *c); |
123 void drawbar(void); |
124 void drawbar(void); |
124 void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); |
125 void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); |
168 void tag(const char *arg); |
169 void tag(const char *arg); |
169 unsigned int textnw(const char *text, unsigned int len); |
170 unsigned int textnw(const char *text, unsigned int len); |
170 unsigned int textw(const char *text); |
171 unsigned int textw(const char *text); |
171 void tileh(void); |
172 void tileh(void); |
172 void tilehstack(unsigned int n); |
173 void tilehstack(unsigned int n); |
173 unsigned int tilemaster(void); |
174 Client *tilemaster(unsigned int n); |
|
175 void tileresize(Client *c, int x, int y, int w, int h); |
174 void tilev(void); |
176 void tilev(void); |
175 void tilevstack(unsigned int n); |
177 void tilevstack(unsigned int n); |
176 void togglefloating(const char *arg); |
178 void togglefloating(const char *arg); |
177 void toggletag(const char *arg); |
179 void toggletag(const char *arg); |
178 void toggleview(const char *arg); |
180 void toggleview(const char *arg); |
1577 textw(const char *text) { |
1588 textw(const char *text) { |
1578 return textnw(text, strlen(text)) + dc.font.height; |
1589 return textnw(text, strlen(text)) + dc.font.height; |
1579 } |
1590 } |
1580 |
1591 |
1581 void |
1592 void |
|
1593 tileh(void) { |
|
1594 int x, w; |
|
1595 unsigned int i, n = counttiled(); |
|
1596 Client *c; |
|
1597 |
|
1598 if(n == 0) |
|
1599 return; |
|
1600 c = tilemaster(n); |
|
1601 if(--n == 0) |
|
1602 return; |
|
1603 |
|
1604 x = tx; |
|
1605 w = tw / n; |
|
1606 if(w < bh) |
|
1607 w = tw; |
|
1608 |
|
1609 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { |
|
1610 if(i + 1 == n) /* remainder */ |
|
1611 tileresize(c, x, ty, (tx + tw) - x - 2 * c->border, th - 2 * c->border); |
|
1612 else |
|
1613 tileresize(c, x, ty, w - 2 * c->border, th - 2 * c->border); |
|
1614 if(w != tw) |
|
1615 x = c->x + c->w + 2 * c->border; |
|
1616 } |
|
1617 } |
|
1618 |
|
1619 Client * |
|
1620 tilemaster(unsigned int n) { |
|
1621 Client *c = nexttiled(clients); |
|
1622 |
|
1623 if(n == 1) |
|
1624 tileresize(c, mox, moy, mow - 2 * c->border, moh - 2 * c->border); |
|
1625 else |
|
1626 tileresize(c, mx, my, mw - 2 * c->border, mh - 2 * c->border); |
|
1627 return c; |
|
1628 } |
|
1629 |
|
1630 void |
1582 tileresize(Client *c, int x, int y, int w, int h) { |
1631 tileresize(Client *c, int x, int y, int w, int h) { |
1583 resize(c, x, y, w, h, RESIZEHINTS); |
1632 resize(c, x, y, w, h, RESIZEHINTS); |
1584 if((RESIZEHINTS) && ((c->h < bh) || (c->h > h) || (c->w < bh) || (c->w > w))) |
1633 if((RESIZEHINTS) && ((c->h < bh) || (c->h > h) || (c->w < bh) || (c->w > w))) |
1585 /* client doesn't accept size constraints */ |
1634 /* client doesn't accept size constraints */ |
1586 resize(c, x, y, w, h, False); |
1635 resize(c, x, y, w, h, False); |
1587 } |
1636 } |
1588 |
1637 |
1589 void |
1638 void |
1590 tileh(void) { |
1639 tilev(void) { |
1591 tilehstack(tilemaster()); |
1640 int y, h; |
1592 } |
1641 unsigned int i, n = counttiled(); |
1593 |
|
1594 void |
|
1595 tilehstack(unsigned int n) { |
|
1596 int i, x, w; |
|
1597 Client *c; |
1642 Client *c; |
1598 |
1643 |
1599 if(n == 0) |
1644 if(n == 0) |
1600 return; |
1645 return; |
1601 |
1646 c = tilemaster(n); |
1602 x = tx; |
1647 if(--n == 0) |
1603 w = tw / n; |
|
1604 if(w < bh) |
|
1605 w = tw; |
|
1606 |
|
1607 for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) |
|
1608 if(i > 0) { |
|
1609 if(i > 1 && i == n) /* remainder */ |
|
1610 tileresize(c, x, ty, (tx + tw) - x - 2 * c->border, |
|
1611 th - 2 * c->border); |
|
1612 else |
|
1613 tileresize(c, x, ty, w - 2 * c->border, |
|
1614 th - 2 * c->border); |
|
1615 if(w != tw) |
|
1616 x = c->x + c->w + 2 * c->border; |
|
1617 } |
|
1618 } |
|
1619 |
|
1620 unsigned int |
|
1621 tilemaster(void) { |
|
1622 unsigned int n; |
|
1623 Client *c, *mc; |
|
1624 |
|
1625 for(n = 0, mc = c = nexttiled(clients); c; c = nexttiled(c->next)) |
|
1626 n++; |
|
1627 if(n == 0) |
|
1628 return 0; |
|
1629 if(n == 1) |
|
1630 tileresize(mc, mox, moy, mow - 2 * mc->border, moh - 2 * mc->border); |
|
1631 else |
|
1632 tileresize(mc, mx, my, mw - 2 * mc->border, mh - 2 * mc->border); |
|
1633 return n - 1; |
|
1634 } |
|
1635 |
|
1636 void |
|
1637 tilev(void) { |
|
1638 tilevstack(tilemaster()); |
|
1639 } |
|
1640 |
|
1641 void |
|
1642 tilevstack(unsigned int n) { |
|
1643 int i, y, h; |
|
1644 Client *c; |
|
1645 |
|
1646 if(n == 0) |
|
1647 return; |
1648 return; |
1648 |
1649 |
1649 y = ty; |
1650 y = ty; |
1650 h = th / n; |
1651 h = th / n; |
1651 if(h < bh) |
1652 if(h < bh) |
1652 h = th; |
1653 h = th; |
1653 |
1654 |
1654 for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) |
1655 for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { |
1655 if(i > 0) { |
1656 if(i + 1 == n) /* remainder */ |
1656 if(i > 1 && i == n) /* remainder */ |
1657 tileresize(c, tx, y, tw - 2 * c->border, (ty + th) - y - 2 * c->border); |
1657 tileresize(c, tx, y, tw - 2 * c->border, |
1658 else |
1658 (ty + th) - y - 2 * c->border); |
1659 tileresize(c, tx, y, tw - 2 * c->border, h - 2 * c->border); |
1659 else |
1660 if(h != th) |
1660 tileresize(c, tx, y, tw - 2 * c->border, |
1661 y = c->y + c->h + 2 * c->border; |
1661 h - 2 * c->border); |
1662 } |
1662 if(h != th) |
|
1663 y = c->y + c->h + 2 * c->border; |
|
1664 } |
|
1665 } |
1663 } |
1666 |
1664 |
1667 void |
1665 void |
1668 togglefloating(const char *arg) { |
1666 togglefloating(const char *arg) { |
1669 if(!sel) |
1667 if(!sel) |