| 99 |
99 |
|
const char *arg; |
| 100 |
100 |
|
} Key; |
| 101 |
101 |
|
|
|
102 |
+ |
typedef struct Monitor Monitor; |
| 102 |
103 |
|
typedef struct { |
| 103 |
104 |
|
const char *symbol; |
| 104 |
|
- |
void (*arrange)(void); |
|
105 |
+ |
void (*arrange)(Monitor *); |
| 105 |
106 |
|
} Layout; |
| 106 |
107 |
|
|
| 107 |
108 |
|
typedef struct { |
|
| 116 |
117 |
|
regex_t *tagregex; |
| 117 |
118 |
|
} Regs; |
| 118 |
119 |
|
|
| 119 |
|
- |
typedef struct { |
| 120 |
|
- |
Window barwin; |
|
120 |
+ |
struct Monitor { |
|
121 |
+ |
unsigned int id; |
| 121 |
122 |
|
int sx, sy, sw, sh, wax, way, wah, waw; |
|
123 |
+ |
double mwfact; |
| 122 |
124 |
|
Bool *seltags; |
| 123 |
125 |
|
Bool *prevtags; |
| 124 |
126 |
|
Layout *layout; |
| 125 |
|
- |
double mwfact; |
| 126 |
|
- |
} Monitor; |
|
127 |
+ |
Window barwin; |
|
128 |
+ |
}; |
|
129 |
+ |
|
| 127 |
130 |
|
|
| 128 |
131 |
|
/* function declarations */ |
| 129 |
132 |
|
void applyrules(Client *c); |
|
| 148 |
151 |
|
void enternotify(XEvent *e); |
| 149 |
152 |
|
void eprint(const char *errstr, ...); |
| 150 |
153 |
|
void expose(XEvent *e); |
| 151 |
|
- |
void floating(void); /* default floating layout */ |
|
154 |
+ |
void floating(Monitor *m); /* default floating layout */ |
| 152 |
155 |
|
void focus(Client *c); |
| 153 |
156 |
|
void focusin(XEvent *e); |
| 154 |
157 |
|
void focusnext(const char *arg); |
|
| 188 |
191 |
|
void tag(const char *arg); |
| 189 |
192 |
|
unsigned int textnw(const char *text, unsigned int len); |
| 190 |
193 |
|
unsigned int textw(const char *text); |
| 191 |
|
- |
void tile(void); |
|
194 |
+ |
void tile(Monitor *m); |
| 192 |
195 |
|
void togglebar(const char *arg); |
| 193 |
196 |
|
void togglefloating(const char *arg); |
| 194 |
197 |
|
void toggletag(const char *arg); |
|
| 304 |
307 |
|
else |
| 305 |
308 |
|
ban(c); |
| 306 |
309 |
|
|
| 307 |
|
- |
monitors[selmonitor].layout->arrange(); |
|
310 |
+ |
monitors[selmonitor].layout->arrange(&monitors[selmonitor]); |
| 308 |
311 |
|
focus(NULL); |
| 309 |
312 |
|
restack(); |
| 310 |
313 |
|
} |
|
| 719 |
722 |
|
} |
| 720 |
723 |
|
|
| 721 |
724 |
|
void |
| 722 |
|
- |
floating(void) { /* default floating layout */ |
|
725 |
+ |
floating(Monitor *m) { /* default floating layout */ |
| 723 |
726 |
|
Client *c; |
| 724 |
727 |
|
|
| 725 |
728 |
|
domwfact = dozoom = False; |
| 726 |
729 |
|
for(c = clients; c; c = c->next) |
| 727 |
|
- |
if(isvisible(c, selmonitor)) |
|
730 |
+ |
if(isvisible(c, m->id)) |
| 728 |
731 |
|
resize(c, c->x, c->y, c->w, c->h, True); |
| 729 |
732 |
|
} |
| 730 |
733 |
|
|
|
| 1598 |
1601 |
|
for(i = 0; i < mcount; i++) { |
| 1599 |
1602 |
|
/* init geometry */ |
| 1600 |
1603 |
|
m = &monitors[i]; |
|
1604 |
+ |
m->id = i; |
| 1601 |
1605 |
|
|
| 1602 |
1606 |
|
if (mcount != 1 && isxinerama) { |
| 1603 |
1607 |
|
m->sx = info[i].x_org; |
|
| 1714 |
1718 |
|
} |
| 1715 |
1719 |
|
|
| 1716 |
1720 |
|
void |
| 1717 |
|
- |
tile(void) { |
| 1718 |
|
- |
unsigned int i, j, n, nx, ny, nw, nh, mw, th; |
|
1721 |
+ |
tile(Monitor *m) { |
|
1722 |
+ |
unsigned int i, n, nx, ny, nw, nh, mw, th; |
| 1719 |
1723 |
|
Client *c, *mc; |
| 1720 |
1724 |
|
|
| 1721 |
1725 |
|
domwfact = dozoom = True; |
| 1722 |
1726 |
|
|
| 1723 |
1727 |
|
nx = ny = nw = 0; /* gcc stupidity requires this */ |
| 1724 |
1728 |
|
|
| 1725 |
|
- |
for (i = 0; i < mcount; i++) { |
| 1726 |
|
- |
Monitor *m = &monitors[i]; |
| 1727 |
|
- |
|
| 1728 |
|
- |
for(n = 0, c = nexttiled(clients, i); c; c = nexttiled(c->next, i)) |
| 1729 |
|
- |
n++; |
|
1729 |
+ |
for(n = 0, c = nexttiled(clients, m->id); c; c = nexttiled(c->next, m->id)) |
|
1730 |
+ |
n++; |
| 1730 |
1731 |
|
|
| 1731 |
|
- |
/* window geoms */ |
| 1732 |
|
- |
mw = (n == 1) ? m->waw : m->mwfact * m->waw; |
| 1733 |
|
- |
th = (n > 1) ? m->wah / (n - 1) : 0; |
| 1734 |
|
- |
if(n > 1 && th < bh) |
| 1735 |
|
- |
th = m->wah; |
|
1732 |
+ |
/* window geoms */ |
|
1733 |
+ |
mw = (n == 1) ? m->waw : m->mwfact * m->waw; |
|
1734 |
+ |
th = (n > 1) ? m->wah / (n - 1) : 0; |
|
1735 |
+ |
if(n > 1 && th < bh) |
|
1736 |
+ |
th = m->wah; |
| 1736 |
1737 |
|
|
| 1737 |
|
- |
for(j = 0, c = mc = nexttiled(clients, i); c; c = nexttiled(c->next, i)) { |
| 1738 |
|
- |
if(j == 0) { /* master */ |
| 1739 |
|
- |
nx = m->wax; |
|
1738 |
+ |
for(i = 0, c = mc = nexttiled(clients, m->id); c; c = nexttiled(c->next, m->id)) { |
|
1739 |
+ |
if(i == 0) { /* master */ |
|
1740 |
+ |
nx = m->wax; |
|
1741 |
+ |
ny = m->way; |
|
1742 |
+ |
nw = mw - 2 * c->border; |
|
1743 |
+ |
nh = m->wah - 2 * c->border; |
|
1744 |
+ |
} |
|
1745 |
+ |
else { /* tile window */ |
|
1746 |
+ |
if(i == 1) { |
| 1740 |
1747 |
|
ny = m->way; |
| 1741 |
|
- |
nw = mw - 2 * c->border; |
| 1742 |
|
- |
nh = m->wah - 2 * c->border; |
| 1743 |
|
- |
} |
| 1744 |
|
- |
else { /* tile window */ |
| 1745 |
|
- |
if(j == 1) { |
| 1746 |
|
- |
ny = m->way; |
| 1747 |
|
- |
nx += mc->w + 2 * mc->border; |
| 1748 |
|
- |
nw = m->waw - mw - 2 * c->border; |
| 1749 |
|
- |
} |
| 1750 |
|
- |
if(j + 1 == n) /* remainder */ |
| 1751 |
|
- |
nh = (m->way + m->wah) - ny - 2 * c->border; |
| 1752 |
|
- |
else |
| 1753 |
|
- |
nh = th - 2 * c->border; |
|
1748 |
+ |
nx += mc->w + 2 * mc->border; |
|
1749 |
+ |
nw = m->waw - mw - 2 * c->border; |
| 1754 |
1750 |
|
} |
| 1755 |
|
- |
fprintf(stderr, "tile(%d, %d, %d, %d)\n", nx, ny, nw, nh); |
| 1756 |
|
- |
resize(c, nx, ny, nw, nh, RESIZEHINTS); |
| 1757 |
|
- |
if((RESIZEHINTS) && ((c->h < bh) || (c->h > nh) || (c->w < bh) || (c->w > nw))) |
| 1758 |
|
- |
/* client doesn't accept size constraints */ |
| 1759 |
|
- |
resize(c, nx, ny, nw, nh, False); |
| 1760 |
|
- |
if(n > 1 && th != m->wah) |
| 1761 |
|
- |
ny = c->y + c->h + 2 * c->border; |
|
1751 |
+ |
if(i + 1 == n) /* remainder */ |
|
1752 |
+ |
nh = (m->way + m->wah) - ny - 2 * c->border; |
|
1753 |
+ |
else |
|
1754 |
+ |
nh = th - 2 * c->border; |
|
1755 |
+ |
} |
|
1756 |
+ |
resize(c, nx, ny, nw, nh, RESIZEHINTS); |
|
1757 |
+ |
if((RESIZEHINTS) && ((c->h < bh) || (c->h > nh) || (c->w < bh) || (c->w > nw))) |
|
1758 |
+ |
/* client doesn't accept size constraints */ |
|
1759 |
+ |
resize(c, nx, ny, nw, nh, False); |
|
1760 |
+ |
if(n > 1 && th != m->wah) |
|
1761 |
+ |
ny = c->y + c->h + 2 * c->border; |
| 1762 |
1762 |
|
|
| 1763 |
|
- |
j++; |
| 1764 |
|
- |
} |
|
1763 |
+ |
i++; |
| 1765 |
1764 |
|
} |
| 1766 |
|
- |
fprintf(stderr, "done\n"); |
| 1767 |
1765 |
|
} |
| 1768 |
1766 |
|
void |
| 1769 |
1767 |
|
togglebar(const char *arg) { |
|
| 2045 |
2043 |
|
int |
| 2046 |
2044 |
|
main(int argc, char *argv[]) { |
| 2047 |
2045 |
|
if(argc == 2 && !strcmp("-v", argv[1])) |
| 2048 |
|
- |
eprint("dwm-"VERSION", © 2006-2007 Anselm R. Garbe, Sander van Dijk, " |
|
2046 |
+ |
eprint("dwm-"VERSION", © 2006-2008 Anselm R. Garbe, Sander van Dijk, " |
| 2049 |
2047 |
|
"Jukka Salmi, Premysl Hruby, Szabolcs Nagy, Christof Musik\n"); |
| 2050 |
2048 |
|
else if(argc != 1) |
| 2051 |
2049 |
|
eprint("usage: dwm [-v]\n"); |