summaryrefslogtreecommitdiffstats
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
parentfixed XSync handling and finished man page (diff)
downloaddwm-901b3ed9b7e3e4c7542797301ae2442938bcea20.tar.gz
dwm-901b3ed9b7e3e4c7542797301ae2442938bcea20.zip
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)
192void 192void
193manage(Window w, XWindowAttributes *wa) 193manage(Window w, XWindowAttributes *wa)
194{ 194{
195 Client *c, **l; 195 Client *c;
196 XSetWindowAttributes twa; 196 XSetWindowAttributes twa;
197 Window trans; 197 Window trans;
198 198
@@ -223,10 +223,11 @@ manage(Window w, XWindowAttributes *wa)
223 settitle(c); 223 settitle(c);
224 settags(c); 224 settags(c);
225 225
226 for(l = &clients; *l; l = &(*l)->next); 226 c->next = clients;
227 c->next = *l; /* *l == nil */ 227 clients = c;
228 *l = c;
229 228
229 XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask,
230 GrabModeAsync, GrabModeSync, None, None);
230 XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask, 231 XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
231 GrabModeAsync, GrabModeSync, None, None); 232 GrabModeAsync, GrabModeSync, None, None);
232 XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask, 233 XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
@@ -234,8 +235,8 @@ manage(Window w, XWindowAttributes *wa)
234 XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask, 235 XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
235 GrabModeAsync, GrabModeSync, None, None); 236 GrabModeAsync, GrabModeSync, None, None);
236 237
237 if(!c->dofloat) 238 if(!c->isfloat)
238 c->dofloat = trans 239 c->isfloat = trans
239 || ((c->maxw == c->minw) && (c->maxh == c->minh)); 240 || ((c->maxw == c->minw) && (c->maxh == c->minh));
240 241
241 arrange(NULL); 242 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
5.B dwm 5.B dwm
6.RB [ \-v ] 6.RB [ \-v ]
7.SH DESCRIPTION 7.SH DESCRIPTION
8.SS Overview
9.B dwm 8.B dwm
10is a dynamic window manager for X11. It consists of a small status bar at the 9is a dynamic window manager for X11. It consists of a small status bar and
11top of the screen and arranges windows in either a tiled or floating mode. 10arranges windows in either a tiled or floating mode.
12.P 11.P
13If 12In tiled mode
14.B dwm 13.B dwm
15is in tiled mode, it consists of two columns. The left master column 14manages all windows in a left master column and a right stacking column. The
16contains only one window per time, the right column contains all other windows 15master column contains a single window, the left stacking column all other
17in a stack. In tiled mode 16windows. Dialog windows are treated floating.
18.B dwm
19.B don't
20handles incremental resizals, some terminal programs like
21.B xterm
22may not work correctly with this in tiled mode.
23.P 17.P
24If 18In floating mode
25.B dwm
26is in floating mode, it arranges all windows with the reqyested geometry and
27allows the user to move or resize them. Some windows, like
28dialog windows, are treated floating even if
29.B dwm 19.B dwm
30is in tiled mode. In floating mode 20manages all windows in a conventional way. They can be resized and moved freely
31.B dwm 21with the mouse.
32handles incremental resizals.
33.P 22.P
34Windows are grouped by tags. You can view all windows with a specific tag per 23Windows are grouped by tags. You can view all windows with a specific tag per
35time. However, each window is allowed to contain more than one tag, which 24time. However, each window is allowed to contain more than one tag, which
36allows to make windows visible in all views. 25allows to make windows visible in all views.
37.P 26.P
38.B dwm 27.B dwm
39reads from 28reads from standard input to display status text, if written.
40.I stdin
41to display status text, if written.
42.P 29.P
43.B dwm 30.B dwm
44draws 1-pixel borders around windows to indicate the focus state and save as 31draws 1-pixel borders around windows to indicate the focus state and providing as
45much screen real estate as possible. Unfocused windows contain a small bar 32much screen real estate as possible. Unfocused windows contain a small bar
46in front of the window indicating the tags and the window title. 33in front of the window indicating the tags and the window title.
47.SS Options 34.SH OPTIONS
48.TP 35.TP
49.B \-v 36.B \-v
50prints version information to 37prints version information to standard output, then exits.
51.I stdout 38.SH CUSTOMIZATION
52, then exits.
53.SS Customization
54.B dwm 39.B dwm
55is customized through editing its source code. It is assumed that 40is customized through editing its source code. It is assumed that
56dwm users are high experienced users who know how a window manager works
57and who are able to patch
58.B dwm
59for their needs. This keeps
60.B dwm 41.B dwm
61fast, secure and simple, because it does not process any input data, except 42users know to patch it for their needs. This keeps it fast, secure and simple,
62window properties and the status text read from 43because it does not process any input data, except window properties and
63.I stdin . 44the status text read from standard input.
64.SS Default Key Bindings 45.SS Keyboard Control
65.TP 16 46.TP 16
66.I Key 47.I Key
67.I Action 48.I Action
@@ -71,7 +52,7 @@ Zoom
71.B window 52.B window
72to the 53to the
73.B master 54.B master
74track 55column
75.TP 56.TP
76.B Mod1-k 57.B Mod1-k
77Focus previous 58Focus previous
@@ -127,7 +108,7 @@ Append
127.B nth 108.B nth
128tag to cureent 109tag to cureent
129.B window 110.B window
130.SS Default Mouse Bindings 111.SS Mouse Control
131.TP 112.TP
132.B Mod1-Button1 113.B Mod1-Button1
133Moves current 114Moves current
@@ -142,7 +123,3 @@ Lowers current
142Resizes current 123Resizes current
143.B window 124.B window
144while dragging 125while dragging
145.SH BUGS
146Some terminal programs do not behave correctly in tiled mode, because
147incremental resizals are ignored to use maximum screen real estate. You can
148patch 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 {
71 int grav; 71 int grav;
72 unsigned int border; 72 unsigned int border;
73 long flags; 73 long flags;
74 Bool dofloat; 74 Bool isfloat;
75 Window win; 75 Window win;
76 Window title; 76 Window title;
77 Client *next; 77 Client *next;
@@ -82,7 +82,7 @@ struct Rule {
82 const char *class; 82 const char *class;
83 const char *instance; 83 const char *instance;
84 char *tags[TLast]; 84 char *tags[TLast];
85 Bool dofloat; 85 Bool isfloat;
86}; 86};
87 87
88struct Key { 88struct Key {
diff --git a/event.c b/event.c
index e948cb3..ecbb8d2 100644
--- a/event.c
+++ b/event.c
@@ -14,8 +14,8 @@
14/********** CUSTOMIZE **********/ 14/********** CUSTOMIZE **********/
15 15
16const char *term[] = { 16const char *term[] = {
17 "urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn", 17 "urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
18 "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL 18 "-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
19}; 19};
20const char *browse[] = { "firefox", NULL }; 20const char *browse[] = { "firefox", NULL };
21const char *xlock[] = { "xlock", NULL }; 21const char *xlock[] = { "xlock", NULL };
@@ -128,18 +128,34 @@ buttonpress(XEvent *e)
128 Client *c; 128 Client *c;
129 129
130 if(barwin == ev->window) { 130 if(barwin == ev->window) {
131 x = 0; 131 switch(ev->button) {
132 for(a.i = 0; a.i < TLast; a.i++) { 132 default:
133 x += textw(tags[a.i]); 133 x = 0;
134 if(ev->x < x) { 134 for(a.i = 0; a.i < TLast; a.i++) {
135 view(&a); 135 x += textw(tags[a.i]);
136 break; 136 if(ev->x < x) {
137 view(&a);
138 break;
139 }
137 } 140 }
141 break;
142 case Button4:
143 a.i = (tsel + 1 < TLast) ? tsel + 1 : 0;
144 view(&a);
145 break;
146 case Button5:
147 a.i = (tsel - 1 >= 0) ? tsel - 1 : TLast - 1;
148 view(&a);
149 break;
138 } 150 }
139 } 151 }
140 else if((c = getclient(ev->window))) { 152 else if((c = getclient(ev->window))) {
141 if(arrange == dotile && !c->dofloat) 153 if(arrange == dotile && !c->isfloat) {
154 if((ev->state & ControlMask) && (ev->button == Button1))
155 zoom(NULL);
142 return; 156 return;
157 }
158 /* floating windows */
143 higher(c); 159 higher(c);
144 switch(ev->button) { 160 switch(ev->button) {
145 default: 161 default:
@@ -297,7 +313,7 @@ propertynotify(XEvent *e)
297 default: break; 313 default: break;
298 case XA_WM_TRANSIENT_FOR: 314 case XA_WM_TRANSIENT_FOR:
299 XGetTransientForHint(dpy, c->win, &trans); 315 XGetTransientForHint(dpy, c->win, &trans);
300 if(!c->dofloat && (c->dofloat = (trans != 0))) 316 if(!c->isfloat && (c->isfloat = (trans != 0)))
301 arrange(NULL); 317 arrange(NULL);
302 break; 318 break;
303 case XA_WM_NORMAL_HINTS: 319 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] = {
17}; 17};
18 18
19static Rule rule[] = { 19static Rule rule[] = {
20 /* class instance tags dofloat */ 20 /* class instance tags isfloat */
21 { "Firefox-bin", "Gecko", { [Twww] = "www" }, False }, 21 { "Firefox-bin", "Gecko", { [Twww] = "www" }, False },
22}; 22};
23 23
@@ -67,7 +67,7 @@ dotile(Arg *arg)
67 w = sw - mw; 67 w = sw - mw;
68 arrange = dotile; 68 arrange = dotile;
69 for(n = 0, c = clients; c; c = c->next) 69 for(n = 0, c = clients; c; c = c->next)
70 if(c->tags[tsel] && !c->dofloat) 70 if(c->tags[tsel] && !c->isfloat)
71 n++; 71 n++;
72 72
73 if(n > 1) 73 if(n > 1)
@@ -77,7 +77,7 @@ dotile(Arg *arg)
77 77
78 for(i = 0, c = clients; c; c = c->next) { 78 for(i = 0, c = clients; c; c = c->next) {
79 if(c->tags[tsel]) { 79 if(c->tags[tsel]) {
80 if(c->dofloat) { 80 if(c->isfloat) {
81 higher(c); 81 higher(c);
82 resize(c, True); 82 resize(c, True);
83 continue; 83 continue;
@@ -155,7 +155,7 @@ settags(Client *c)
155 { 155 {
156 for(j = 0; j < TLast; j++) 156 for(j = 0; j < TLast; j++)
157 c->tags[j] = rule[i].tags[j]; 157 c->tags[j] = rule[i].tags[j];
158 c->dofloat = rule[i].dofloat; 158 c->isfloat = rule[i].isfloat;
159 matched = True; 159 matched = True;
160 break; 160 break;
161 } 161 }