about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--dwm.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/dwm.c b/dwm.c
index 0e8c927..6084123 100644
--- a/dwm.c
+++ b/dwm.c
@@ -44,8 +44,8 @@
 #define BUTTONMASK              (ButtonPressMask|ButtonReleaseMask)
 #define CLEANMASK(mask)         (mask & ~(numlockmask|LockMask))
 #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH))
-#define ISVISIBLE(x)            (x->tags & tagset[mon[x->mon].seltags])
-#define LENGTH(x)               (sizeof x / sizeof x[0])
+#define ISVISIBLE(M, C)         ((M) == (&mon[C->mon]) && (C->tags & tagset[M->seltags]))
+#define LENGTH(X)               (sizeof X / sizeof X[0])
 #define MAX(a, b)               ((a) > (b) ? (a) : (b))
 #define MIN(a, b)               ((a) < (b) ? (a) : (b))
 #define MOUSEMASK               (BUTTONMASK|PointerMotionMask)
@@ -493,7 +493,7 @@ configurenotify(XEvent *e) {
 		updategeom();
 		if(dc.drawable != 0)
 			XFreePixmap(dpy, dc.drawable);
-		dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen));
+		dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
 		for(i = 0; i < nmons; i++)
 			XMoveResizeWindow(dpy, mon[i].barwin, mon[i].wx, mon[i].by, mon[i].ww, bh);
 		arrange();
@@ -524,7 +524,7 @@ configurerequest(XEvent *e) {
 				c->y = sy + (sh / 2 - c->h / 2); /* center in y direction */
 			if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight)))
 				configure(c);
-			if(ISVISIBLE(c))
+			if(ISVISIBLE((&mon[c->mon]), c))
 				XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
 		}
 		else
@@ -636,6 +636,7 @@ drawbar(Monitor *m) {
 		}
 	}
 	else {
+		dc.x = x;
 		dc.w = m->ww - x;
 		drawtext(NULL, dc.norm, False);
 	}
@@ -718,17 +719,18 @@ expose(XEvent *e) {
 	unsigned int i;
 	XExposeEvent *ev = &e->xexpose;
 
-	for(i = 0; i < nmons; i++)
-		if(ev->count == 0 && (ev->window == mon[i].barwin)) {
-			drawbar(&mon[i]);
-			break;
-		}
+	if(ev->count == 0)
+		for(i = 0; i < nmons; i++)
+			if(ev->window == mon[i].barwin) {
+				drawbar(&mon[i]);
+				break;
+			}
 }
 
 void
 focus(Client *c) {
-	if(!c || !ISVISIBLE(c))
-		for(c = stack; c && !ISVISIBLE(c); c = c->snext);
+	if(!c || !ISVISIBLE((&mon[c->mon]), c))
+		for(c = stack; c && !ISVISIBLE(selmon, c); c = c->snext);
 	if(sel && sel != c) {
 		grabbuttons(sel, False);
 		XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
@@ -776,17 +778,17 @@ focusstack(const Arg *arg) {
 	if(!sel)
 		return;
 	if(arg->i > 0) {
-		for(c = sel->next; c && !ISVISIBLE(c); c = c->next);
+		for(c = sel->next; c && !ISVISIBLE(selmon, c); c = c->next);
 		if(!c)
-			for(c = clients; c && !ISVISIBLE(c); c = c->next);
+			for(c = clients; c && !ISVISIBLE(selmon, c); c = c->next);
 	}
 	else {
 		for(i = clients; i != sel; i = i->next)
-			if(ISVISIBLE(i))
+			if(ISVISIBLE(selmon, i))
 				c = i;
 		if(!c)
 			for(; i; i = i->next)
-				if(ISVISIBLE(i))
+				if(ISVISIBLE(selmon, i))
 					c = i;
 	}
 	if(c) {
@@ -1126,7 +1128,7 @@ movemouse(const Arg *arg) {
 Client *
 nexttiled(Monitor *m, Client *c) {
 	// TODO: m handling
-	for(; c && (c->isfloating || m != &mon[c->mon] || !ISVISIBLE(c)); c = c->next);
+	for(; c && (c->isfloating || !ISVISIBLE(m, c)); c = c->next);
 	return c;
 }
 
@@ -1246,7 +1248,7 @@ restack(Monitor *m) {
 		wc.stack_mode = Below;
 		wc.sibling = m->barwin;
 		for(c = stack; c; c = c->snext)
-			if(!c->isfloating && m == &mon[c->mon] && ISVISIBLE(c)) {
+			if(!c->isfloating && ISVISIBLE(m, c)) {
 				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
 				wc.sibling = c->win;
 			}
@@ -1408,7 +1410,7 @@ void
 showhide(Client *c) {
 	if(!c)
 		return;
-	if(ISVISIBLE(c)) { /* show clients top down */
+	if(ISVISIBLE((&mon[c->mon]), c)) { /* show clients top down */
 		XMoveWindow(dpy, c->win, c->x, c->y);
 		if(!lt[selmon->sellt]->arrange || c->isfloating)
 			resize(c, c->x, c->y, c->w, c->h);
5aae315fb90'>cdbc84b ^
84432e6 ^
39af3c2 ^
338c083 ^
84432e6 ^

1a25414 ^

b439892 ^
caf5a16 ^
901b3ed ^
1076f2b

901b3ed ^
0c3544d ^
2b35fae ^

a3e3f0b ^

2b35fae ^
3e06ede ^
cdbc84b ^
338c083 ^
292ccc4 ^
d4b7a9a ^
10885d3 ^
1836b67 ^
ee8fb0c ^
7ab8c87 ^
1836b67 ^
ee8fb0c ^
7ab8c87 ^
2b35fae ^
72655f0 ^
ee8fb0c ^
df74b26 ^
0ea0343 ^
72655f0 ^
f22d047 ^


20cd336 ^

39af3c2 ^
ee8fb0c ^
7ab8c87 ^
72655f0 ^
ee8fb0c ^
7ab8c87 ^
3af6434 ^
a355782 ^





d05d09b ^











ee8fb0c ^
1549faf ^
7ab8c87 ^
d05d09b ^
1549faf ^
ee8fb0c ^
d05d09b ^
42fd392 ^
ee8fb0c ^
df74b26 ^
7ab8c87 ^
d05d09b ^
8dc8605 ^
ee8fb0c ^
df74b26 ^
7ab8c87 ^

1549faf ^
ee8fb0c ^
7ab8c87 ^
daae3bb ^
ee8fb0c ^
3e06ede ^
7ab8c87 ^

4bb89e2 ^
ee8fb0c ^
7ab8c87 ^
2b35fae ^
0c3544d ^
ee8fb0c ^
d05d09b ^
0e5c819 ^
ee8fb0c ^
5f55af4 ^
4bd0d33 ^
ee8fb0c ^
d05d09b ^
0c3544d ^
7ab8c87 ^
dc5c070 ^
7e98db2 ^

bced907 ^
60b3dce ^
21bd90d ^
c8f96b5 ^
4bb89e2 ^
c8f96b5 ^



c7da124 ^


c8f96b5 ^

124866e ^
d05d09b ^
124866e ^





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154