about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--dwm.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/dwm.c b/dwm.c
index 352e9db..b61bbf5 100644
--- a/dwm.c
+++ b/dwm.c
@@ -52,6 +52,7 @@
 #define MAXTAGLEN       16
 #define MOUSEMASK       (BUTTONMASK|PointerMotionMask)
 #define TAGMASK         ((int)((1LL << LENGTH(tags)) - 1))
+#define TEXTW(x)        (textnw(x, strlen(x)) + dc.font.height)
 #define VISIBLE(x)      ((x)->tags & tagset[seltags])
 
 /* enums */
@@ -169,7 +170,6 @@ void setup(void);
 void spawn(const void *arg);
 void tag(const void *arg);
 uint textnw(const char *text, uint len);
-uint textw(const char *text);
 void tile(void);
 void tileresize(Client *c, int x, int y, int w, int h);
 void togglebar(const void *arg);
@@ -305,7 +305,7 @@ buttonpress(XEvent *e) {
 	if(ev->window == barwin) {
 		x = 0;
 		for(i = 0; i < LENGTH(tags); i++) {
-			x += textw(tags[i]);
+			x += TEXTW(tags[i]);
 			if(ev->x < x) {
 				mask = 1 << i;
 				if(ev->button == Button1) {
@@ -491,7 +491,7 @@ drawbar(void) {
 	dc.x = 0;
 	for(c = stack; c && !VISIBLE(c); c = c->snext);
 	for(i = 0; i < LENGTH(tags); i++) {
-		dc.w = textw(tags[i]);
+		dc.w = TEXTW(tags[i]);
 		if(tagset[seltags] & 1 << i) {
 			drawtext(tags[i], dc.sel, isurgent(i));
 			drawsquare(c && c->tags & 1 << i, isoccupied(i), isurgent(i), dc.sel);
@@ -509,7 +509,7 @@ drawbar(void) {
 	}
 	else
 		x = dc.x;
-	dc.w = textw(stext);
+	dc.w = TEXTW(stext);
 	dc.x = bw - dc.w;
 	if(dc.x < x) {
 		dc.x = x;
@@ -1365,7 +1365,7 @@ setup(void) {
 
 	/* init bar */
 	for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) {
-		w = textw(layouts[i].symbol);
+		w = TEXTW(layouts[i].symbol);
 		blw = MAX(blw, w);
 	}
 
@@ -1437,11 +1437,6 @@ textnw(const char *text, uint len) {
 	return XTextWidth(dc.font.xfont, text, len);
 }
 
-uint
-textw(const char *text) {
-	return textnw(text, strlen(text)) + dc.font.height;
-}
-
 void
 tile(void) {
 	int x, y, h, w;
/cpp/016compare?h=hlt&id=201b2e6c7ce94c986fe7888a60f0e1ba24a05ce9'>^
6f5d7864 ^
9dc29482 ^










f7051fad ^
9dc29482 ^





















6f5d7864 ^
9dc29482 ^












6f5d7864 ^
9dc29482 ^










f7051fad ^
9dc29482 ^





















6f5d7864 ^
9dc29482 ^












6f5d7864 ^
9dc29482 ^












6f5d7864 ^
9dc29482 ^










f7051fad ^
9dc29482 ^





















6f5d7864 ^
9dc29482 ^












6f5d7864 ^
9dc29482 ^












6f5d7864 ^
9dc29482 ^





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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271