summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LICENSE2
-rw-r--r--config.def.h2
-rw-r--r--dwm.c100
3 files changed, 51 insertions, 53 deletions
diff --git a/LICENSE b/LICENSE
index 1cf40cc..1b32b82 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
1MIT/X Consortium License 1MIT/X Consortium License
2 2
3© 2006-2007 Anselm R. Garbe <garbeam at gmail dot com> 3© 2006-2008 Anselm R. Garbe <garbeam at gmail dot com>
4© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com> 4© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
5© 2006-2007 Jukka Salmi <jukka at salmi dot ch> 5© 2006-2007 Jukka Salmi <jukka at salmi dot ch>
6© 2007 Premysl Hruby <dfenze at gmail dot com> 6© 2007 Premysl Hruby <dfenze at gmail dot com>
diff --git a/config.def.h b/config.def.h
index 3d8e6cb..7866968 100644
--- a/config.def.h
+++ b/config.def.h
@@ -3,7 +3,7 @@
3/* appearance */ 3/* appearance */
4#define BARPOS BarTop /* BarBot, BarOff */ 4#define BARPOS BarTop /* BarBot, BarOff */
5#define BORDERPX 1 5#define BORDERPX 1
6#define FONT "-*-terminus-medium-*-*-*-*-*-*-*-*-*-*-*" 6#define FONT "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*"
7#define NORMBORDERCOLOR "#cccccc" 7#define NORMBORDERCOLOR "#cccccc"
8#define NORMBGCOLOR "#cccccc" 8#define NORMBGCOLOR "#cccccc"
9#define NORMFGCOLOR "#000000" 9#define NORMFGCOLOR "#000000"
diff --git a/dwm.c b/dwm.c
index 66daba3..ff9e66a 100644
--- a/dwm.c
+++ b/dwm.c
@@ -99,9 +99,10 @@ typedef struct {
99 const char *arg; 99 const char *arg;
100} Key; 100} Key;
101 101
102typedef struct Monitor Monitor;
102typedef struct { 103typedef struct {
103 const char *symbol; 104 const char *symbol;
104 void (*arrange)(void); 105 void (*arrange)(Monitor *);
105} Layout; 106} Layout;
106 107
107typedef struct { 108typedef struct {
@@ -116,14 +117,16 @@ typedef struct {
116 regex_t *tagregex; 117 regex_t *tagregex;
117} Regs; 118} Regs;
118 119
119typedef struct { 120struct Monitor {
120 Window barwin; 121 unsigned int id;
121 int sx, sy, sw, sh, wax, way, wah, waw; 122 int sx, sy, sw, sh, wax, way, wah, waw;
123 double mwfact;
122 Bool *seltags; 124 Bool *seltags;
123 Bool *prevtags; 125 Bool *prevtags;
124 Layout *layout; 126 Layout *layout;
125 double mwfact; 127 Window barwin;
126} Monitor; 128};
129
127 130
128/* function declarations */ 131/* function declarations */
129void applyrules(Client *c); 132void applyrules(Client *c);
@@ -148,7 +151,7 @@ void *emallocz(unsigned int size);
148void enternotify(XEvent *e); 151void enternotify(XEvent *e);
149void eprint(const char *errstr, ...); 152void eprint(const char *errstr, ...);
150void expose(XEvent *e); 153void expose(XEvent *e);
151void floating(void); /* default floating layout */ 154void floating(Monitor *m); /* default floating layout */
152void focus(Client *c); 155void focus(Client *c);
153void focusin(XEvent *e); 156void focusin(XEvent *e);
154void focusnext(const char *arg); 157void focusnext(const char *arg);
@@ -188,7 +191,7 @@ void spawn(const char *arg);
188void tag(const char *arg); 191void tag(const char *arg);
189unsigned int textnw(const char *text, unsigned int len); 192unsigned int textnw(const char *text, unsigned int len);
190unsigned int textw(const char *text); 193unsigned int textw(const char *text);
191void tile(void); 194void tile(Monitor *m);
192void togglebar(const char *arg); 195void togglebar(const char *arg);
193void togglefloating(const char *arg); 196void togglefloating(const char *arg);
194void toggletag(const char *arg); 197void toggletag(const char *arg);
@@ -304,7 +307,7 @@ arrange(void) {
304 else 307 else
305 ban(c); 308 ban(c);
306 309
307 monitors[selmonitor].layout->arrange(); 310 monitors[selmonitor].layout->arrange(&monitors[selmonitor]);
308 focus(NULL); 311 focus(NULL);
309 restack(); 312 restack();
310} 313}
@@ -719,12 +722,12 @@ expose(XEvent *e) {
719} 722}
720 723
721void 724void
722floating(void) { /* default floating layout */ 725floating(Monitor *m) { /* default floating layout */
723 Client *c; 726 Client *c;
724 727
725 domwfact = dozoom = False; 728 domwfact = dozoom = False;
726 for(c = clients; c; c = c->next) 729 for(c = clients; c; c = c->next)
727 if(isvisible(c, selmonitor)) 730 if(isvisible(c, m->id))
728 resize(c, c->x, c->y, c->w, c->h, True); 731 resize(c, c->x, c->y, c->w, c->h, True);
729} 732}
730 733
@@ -1598,6 +1601,7 @@ setup(void) {
1598 for(i = 0; i < mcount; i++) { 1601 for(i = 0; i < mcount; i++) {
1599 /* init geometry */ 1602 /* init geometry */
1600 m = &monitors[i]; 1603 m = &monitors[i];
1604 m->id = i;
1601 1605
1602 if (mcount != 1 && isxinerama) { 1606 if (mcount != 1 && isxinerama) {
1603 m->sx = info[i].x_org; 1607 m->sx = info[i].x_org;
@@ -1714,56 +1718,50 @@ textw(const char *text) {
1714} 1718}
1715 1719
1716void 1720void
1717tile(void) { 1721tile(Monitor *m) {
1718 unsigned int i, j, n, nx, ny, nw, nh, mw, th; 1722 unsigned int i, n, nx, ny, nw, nh, mw, th;
1719 Client *c, *mc; 1723 Client *c, *mc;
1720 1724
1721 domwfact = dozoom = True; 1725 domwfact = dozoom = True;
1722 1726
1723 nx = ny = nw = 0; /* gcc stupidity requires this */ 1727 nx = ny = nw = 0; /* gcc stupidity requires this */
1724 1728
1725 for (i = 0; i < mcount; i++) { 1729 for(n = 0, c = nexttiled(clients, m->id); c; c = nexttiled(c->next, m->id))
1726 Monitor *m = &monitors[i]; 1730 n++;
1727 1731
1728 for(n = 0, c = nexttiled(clients, i); c; c = nexttiled(c->next, i)) 1732 /* window geoms */
1729 n++; 1733 mw = (n == 1) ? m->waw : m->mwfact * m->waw;
1730 1734 th = (n > 1) ? m->wah / (n - 1) : 0;
1731 /* window geoms */ 1735 if(n > 1 && th < bh)
1732 mw = (n == 1) ? m->waw : m->mwfact * m->waw; 1736 th = m->wah;
1733 th = (n > 1) ? m->wah / (n - 1) : 0; 1737
1734 if(n > 1 && th < bh) 1738 for(i = 0, c = mc = nexttiled(clients, m->id); c; c = nexttiled(c->next, m->id)) {
1735 th = m->wah; 1739 if(i == 0) { /* master */
1736 1740 nx = m->wax;
1737 for(j = 0, c = mc = nexttiled(clients, i); c; c = nexttiled(c->next, i)) { 1741 ny = m->way;
1738 if(j == 0) { /* master */ 1742 nw = mw - 2 * c->border;
1739 nx = m->wax; 1743 nh = m->wah - 2 * c->border;
1744 }
1745 else { /* tile window */
1746 if(i == 1) {
1740 ny = m->way; 1747 ny = m->way;
1741 nw = mw - 2 * c->border; 1748 nx += mc->w + 2 * mc->border;
1742 nh = m->wah - 2 * c->border; 1749 nw = m->waw - mw - 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;
1754 } 1750 }
1755 fprintf(stderr, "tile(%d, %d, %d, %d)\n", nx, ny, nw, nh); 1751 if(i + 1 == n) /* remainder */
1756 resize(c, nx, ny, nw, nh, RESIZEHINTS); 1752 nh = (m->way + m->wah) - ny - 2 * c->border;
1757 if((RESIZEHINTS) && ((c->h < bh) || (c->h > nh) || (c->w < bh) || (c->w > nw))) 1753 else
1758 /* client doesn't accept size constraints */ 1754 nh = th - 2 * c->border;
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
1763 j++;
1764 } 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
1763 i++;
1765 } 1764 }
1766 fprintf(stderr, "done\n");
1767} 1765}
1768void 1766void
1769togglebar(const char *arg) { 1767togglebar(const char *arg) {
@@ -2045,7 +2043,7 @@ selectmonitor(const char *arg) {
2045int 2043int
2046main(int argc, char *argv[]) { 2044main(int argc, char *argv[]) {
2047 if(argc == 2 && !strcmp("-v", argv[1])) 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 "Jukka Salmi, Premysl Hruby, Szabolcs Nagy, Christof Musik\n"); 2047 "Jukka Salmi, Premysl Hruby, Szabolcs Nagy, Christof Musik\n");
2050 else if(argc != 1) 2048 else if(argc != 1)
2051 eprint("usage: dwm [-v]\n"); 2049 eprint("usage: dwm [-v]\n");