about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-16 00:47:40 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-16 00:47:40 +0200
commit901b3ed9b7e3e4c7542797301ae2442938bcea20 (patch)
treeea20343294992690b7044a87a0364305bef55e3f
parente6cbe9c11e88537d74eb094ba5844f71ee57f268 (diff)
downloaddwm-901b3ed9b7e3e4c7542797301ae2442938bcea20.tar.gz
several additions in mouse handling ;)
-rw-r--r--client.c13
-rw-r--r--dwm.163
-rw-r--r--dwm.h4
-rw-r--r--event.c36
-rw-r--r--tag.c8
5 files changed, 59 insertions, 65 deletions
diff --git a/client.c b/client.c
index 158b928..522a425 100644
--- a/client.c
+++ b/client.c
@@ -192,7 +192,7 @@ lower(Client *c)
 void
 manage(Window w, XWindowAttributes *wa)
 {
-	Client *c, **l;
+	Client *c;
 	XSetWindowAttributes twa;
 	Window trans;
 
@@ -223,10 +223,11 @@ manage(Window w, XWindowAttributes *wa)
 	settitle(c);
 	settags(c);
 
-	for(l = &clients; *l; l = &(*l)->next);
-	c->next = *l; /* *l == nil */
-	*l = c;
+	c->next = clients;
+	clients = c;
 
+	XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask,
+			GrabModeAsync, GrabModeSync, None, None);
 	XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
 			GrabModeAsync, GrabModeSync, None, None);
 	XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
@@ -234,8 +235,8 @@ manage(Window w, XWindowAttributes *wa)
 	XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
 			GrabModeAsync, GrabModeSync, None, None);
 
-	if(!c->dofloat)
-		c->dofloat = trans
+	if(!c->isfloat)
+		c->isfloat = trans
 			|| ((c->maxw == c->minw) && (c->maxh == c->minh));
 
 	arrange(NULL);
diff --git a/dwm.1 b/dwm.1
index 6ae2c39..56dd8b9 100644
--- a/dwm.1
+++ b/dwm.1
@@ -5,63 +5,44 @@ dwm \- dynamic window manager
 .B dwm
 .RB [ \-v ]
 .SH DESCRIPTION
-.SS Overview
 .B dwm
-is a dynamic window manager for X11. It consists of a small status bar at the
-top of the screen and arranges windows in either a tiled or floating mode.
+is a dynamic window manager for X11. It consists of a small status bar and
+arranges windows in either a tiled or floating mode.
 .P
-If 
+In tiled mode
 .B dwm
-is in tiled mode, it consists of two columns. The left master column
-contains only one window per time, the right column contains all other windows 
-in a stack. In tiled mode
-.B dwm
-.B don't
-handles incremental resizals, some terminal programs like
-.B xterm
-may not work correctly with this in tiled mode.
+manages all windows in a left master column and a right stacking column. The
+master column contains a single window, the left stacking column all other
+windows. Dialog windows are treated floating.
 .P
-If
-.B dwm
-is in floating mode, it arranges all windows with the reqyested geometry and
-allows the user to move or resize them. Some windows, like
-dialog windows, are treated floating even if
+In floating mode
 .B dwm
-is in tiled mode. In floating mode
-.B dwm
-handles incremental resizals.
+manages all windows in a conventional way. They can be resized and moved freely
+with the mouse.
 .P
 Windows are grouped by tags. You can view all windows with a specific tag per
 time.  However, each window is allowed to contain more than one tag, which
 allows to make windows visible in all views.
 .P
 .B dwm
-reads from
-.I stdin
-to display status text, if written.
+reads from standard input to display status text, if written.
 .P
 .B dwm
-draws 1-pixel borders around windows to indicate the focus state and save as
+draws 1-pixel borders around windows to indicate the focus state and providing as
 much screen real estate as possible. Unfocused windows contain a small bar
 in front of the window indicating the tags and the window title.
-.SS Options
+.SH OPTIONS
 .TP
 .B \-v
-prints version information to
-.I stdout
-, then exits.
-.SS Customization
+prints version information to standard output, then exits.
+.SH CUSTOMIZATION
 .B dwm
 is customized through editing its source code. It is assumed that
-dwm users are high experienced users who know how a window manager works
-and who are able to patch
-.B dwm
-for their needs. This keeps
 .B dwm
-fast, secure and simple, because it does not process any input data, except
-window properties and the status text read from
-.I stdin .
-.SS Default Key Bindings
+users know to patch it for their needs. This keeps it fast, secure and simple,
+because it does not process any input data, except window properties and
+the status text read from standard input.
+.SS Keyboard Control
 .TP 16
 .I Key	
 .I Action
@@ -71,7 +52,7 @@ Zoom
 .B window
 to the 
 .B master
-track
+column
 .TP
 .B Mod1-k
 Focus previous
@@ -127,7 +108,7 @@ Append
 .B nth
 tag to cureent
 .B window
-.SS Default Mouse Bindings
+.SS Mouse Control
 .TP
 .B Mod1-Button1
 Moves current
@@ -142,7 +123,3 @@ Lowers current
 Resizes current
 .B window
 while dragging
-.SH BUGS
-Some terminal programs do not behave correctly in tiled mode, because
-incremental resizals are ignored to use maximum screen real estate. You can
-patch the code to fix this.
diff --git a/dwm.h b/dwm.h
index e43301c..75aa50c 100644
--- a/dwm.h
+++ b/dwm.h
@@ -71,7 +71,7 @@ struct Client {
 	int grav;
 	unsigned int border;
 	long flags; 
-	Bool dofloat;
+	Bool isfloat;
 	Window win;
 	Window title;
 	Client *next;
@@ -82,7 +82,7 @@ struct Rule {
 	const char *class;
 	const char *instance;
 	char *tags[TLast];
-	Bool dofloat;
+	Bool isfloat;
 };
 
 struct Key {
diff --git a/event.c b/event.c
index e948cb3..ecbb8d2 100644
--- a/event.c
+++ b/event.c
@@ -14,8 +14,8 @@
 /********** CUSTOMIZE **********/
 
 const char *term[] = { 
-	"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn",
-	"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL
+	"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
+	"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
 };
 const char *browse[] = { "firefox", NULL };
 const char *xlock[] = { "xlock", NULL };
@@ -128,18 +128,34 @@ buttonpress(XEvent *e)
 	Client *c;
 
 	if(barwin == ev->window) {
-		x = 0;
-		for(a.i = 0; a.i < TLast; a.i++) {
-			x += textw(tags[a.i]);
-			if(ev->x < x) {
-				view(&a);
-				break;
+		switch(ev->button) {
+		default:
+			x = 0;
+			for(a.i = 0; a.i < TLast; a.i++) {
+				x += textw(tags[a.i]);
+				if(ev->x < x) {
+					view(&a);
+					break;
+				}
 			}
+			break;
+		case Button4:
+			a.i = (tsel + 1 < TLast) ? tsel + 1 : 0;
+			view(&a);
+			break;
+		case Button5:
+			a.i = (tsel - 1 >= 0) ? tsel - 1 : TLast - 1;
+			view(&a);
+			break;
 		}
 	}
 	else if((c = getclient(ev->window))) {
-		if(arrange == dotile && !c->dofloat)
+		if(arrange == dotile && !c->isfloat) {
+			if((ev->state & ControlMask) && (ev->button == Button1))
+				zoom(NULL);
 			return;
+		}
+		/* floating windows */
 		higher(c);
 		switch(ev->button) {
 		default:
@@ -297,7 +313,7 @@ propertynotify(XEvent *e)
 			default: break;
 			case XA_WM_TRANSIENT_FOR:
 				XGetTransientForHint(dpy, c->win, &trans);
-				if(!c->dofloat && (c->dofloat = (trans != 0)))
+				if(!c->isfloat && (c->isfloat = (trans != 0)))
 					arrange(NULL);
 				break;
 			case XA_WM_NORMAL_HINTS:
diff --git a/tag.c b/tag.c
index 8951dd8..48f1f2a 100644
--- a/tag.c
+++ b/tag.c
@@ -17,7 +17,7 @@ char *tags[TLast] = {
 };
 
 static Rule rule[] = {
-	/* class			instance	tags						dofloat */
+	/* class			instance	tags						isfloat */
 	{ "Firefox-bin",	"Gecko",	{ [Twww] = "www" },			False },
 };
 
@@ -67,7 +67,7 @@ dotile(Arg *arg)
 	w = sw - mw;
 	arrange = dotile;
 	for(n = 0, c = clients; c; c = c->next)
-		if(c->tags[tsel] && !c->dofloat)
+		if(c->tags[tsel] && !c->isfloat)
 			n++;
 
 	if(n > 1)
@@ -77,7 +77,7 @@ dotile(Arg *arg)
 
 	for(i = 0, c = clients; c; c = c->next) {
 		if(c->tags[tsel]) {
-			if(c->dofloat) {
+			if(c->isfloat) {
 				higher(c);
 				resize(c, True);
 				continue;
@@ -155,7 +155,7 @@ settags(Client *c)
 				{
 					for(j = 0; j < TLast; j++)
 						c->tags[j] = rule[i].tags[j];
-					c->dofloat = rule[i].dofloat;
+					c->isfloat = rule[i].isfloat;
 					matched = True;
 					break;
 				}
0 committer Kartik Agaram <vc@akkartik.com> 2020-09-07 16:39:44 -0700 6746' href='/akkartik/mu/commit/html/112read-byte.subx.html?h=main&id=68df24fa778f7f5a2651a4623681f38dc920c490'>68df24fa ^
999c529c ^
efe641a0 ^
999c529c ^











6070c23e ^
999c529c ^




ec73ed12 ^
999c529c ^








ec73ed12 ^
999c529c ^



6070c23e ^
999c529c ^


8aeb85f0 ^




















3d1c4216 ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^





ec73ed12 ^
8aeb85f0 ^




3d1c4216 ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^



68df24fa ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^







ec73ed12 ^
8aeb85f0 ^









3d1c4216 ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^





ec73ed12 ^
8aeb85f0 ^




3d1c4216 ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^



68df24fa ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^



68df24fa ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^







ec73ed12 ^
8aeb85f0 ^









3d1c4216 ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^





ec73ed12 ^
8aeb85f0 ^



68df24fa ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^







ec73ed12 ^
8aeb85f0 ^









3d1c4216 ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^





ec73ed12 ^
8aeb85f0 ^




3d1c4216 ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^


9a777801 ^
68df24fa ^
8aeb85f0 ^


68df24fa ^
8aeb85f0 ^
ec73ed12 ^
8aeb85f0 ^







ec73ed12 ^
8aeb85f0 ^




68df24fa ^
91a5f3e1 ^
68df24fa ^














































3d1c4216 ^
68df24fa ^















d3a9db3a ^

68df24fa ^















d3a9db3a ^































































d1c9392a ^



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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484