about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-12 00:00:25 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-12 00:00:25 +0200
commit2a0fc84c4af2257d79c4c7cb37131c4acb763162 (patch)
treee335ce623b7f79186b52bc1d73acbfead90cab08
parent896f08d7d553f7def3877648c113cf03e6ca546a (diff)
downloaddwm-2a0fc84c4af2257d79c4c7cb37131c4acb763162.tar.gz
some more additions/fixes
-rw-r--r--client.c13
-rw-r--r--cmd.c16
-rw-r--r--event.c2
-rw-r--r--kb.c2
-rw-r--r--wm.h2
5 files changed, 32 insertions, 3 deletions
diff --git a/client.c b/client.c
index eb3acf4..ee659c4 100644
--- a/client.c
+++ b/client.c
@@ -93,6 +93,7 @@ focus(Client *c)
 	}
 	XUnmapWindow(dpy, c->title);
 	draw_bar();
+	discard_events(EnterWindowMask);
 	XFlush(dpy);
 }
 
@@ -116,7 +117,7 @@ manage(Window w, XWindowAttributes *wa)
 	XGetTransientForHint(dpy, c->win, &c->trans);
 	twa.override_redirect = 1;
 	twa.background_pixmap = ParentRelative;
-	twa.event_mask = SubstructureNotifyMask | ExposureMask;
+	twa.event_mask = ExposureMask;
 
 	c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
 			0, DefaultDepth(dpy, screen), CopyFromParent,
@@ -191,11 +192,19 @@ unmanage(Client *c)
 	XFlush(dpy);
 	XSetErrorHandler(error_handler);
 	XUngrabServer(dpy);
-	discard_events(EnterWindowMask);
 	if(stack)
 		focus(stack);
 }
 
+Client *
+gettitle(Window w)
+{
+	Client *c;
+	for(c = clients; c; c = c->next)
+		if(c->title == w)
+			return c;
+	return NULL;
+}
 
 Client *
 getclient(Window w)
diff --git a/cmd.c b/cmd.c
index 4f1c84b..c14c3e6 100644
--- a/cmd.c
+++ b/cmd.c
@@ -20,6 +20,22 @@ quit(void *aux)
 }
 
 void
+sel(void *aux)
+{
+	const char *arg = aux;
+	Client *c;
+
+	if(!arg || !stack)
+		return;
+	if(!strncmp(arg, "next", 5))
+		focus(stack->snext ? stack->snext : stack);
+	else if(!strncmp(arg, "prev", 5)) {
+		for(c = stack; c && c->snext; c = c->snext);
+		focus(c ? c : stack);
+	}
+}
+
+void
 kill(void *aux)
 {
 	Client *c = stack;
diff --git a/event.c b/event.c
index ba41f55..a47bc25 100644
--- a/event.c
+++ b/event.c
@@ -146,7 +146,7 @@ expose(XEvent *e)
 	Client *c;
 
 	if(ev->count == 0) {
-		if((c = getclient(ev->window)))
+		if((c = gettitle(ev->window)))
 			draw_client(c);
 		else if(ev->window == barwin)
 			draw_bar();
diff --git a/kb.c b/kb.c
index b9cf1cb..7eb788a 100644
--- a/kb.c
+++ b/kb.c
@@ -19,6 +19,8 @@ static const char *proglist[] = {
 static Key key[] = {
 	{ Mod1Mask, XK_Return, run, term },
 	{ Mod1Mask, XK_p, run, proglist }, 
+	{ Mod1Mask, XK_k, sel, "prev"}, 
+	{ Mod1Mask, XK_j, sel, "next"}, 
 	{ Mod1Mask | ShiftMask, XK_c, kill, NULL}, 
 	{ Mod1Mask | ShiftMask, XK_q, quit, NULL},
 };
diff --git a/wm.h b/wm.h
index fc07b5c..8f31f60 100644
--- a/wm.h
+++ b/wm.h
@@ -63,6 +63,7 @@ extern void draw_bar();
 extern void run(void *aux);
 extern void quit(void *aux);
 extern void kill(void *aux);
+extern void sel(void *aux);
 
 /* client.c */
 extern void manage(Window w, XWindowAttributes *wa);
@@ -73,6 +74,7 @@ extern void update_name(Client *c);
 extern void draw_client(Client *c);
 extern void resize(Client *c);
 extern void update_size(Client *c);
+extern Client *gettitle(Window w);
 
 /* event.c */
 extern unsigned int discard_events(long even_mask);
08-22 21:41:57 +0100 committer Silvino Silva <silvino@bk.ru> 2016-08-22 21:41:57 +0100 added all core files' href='/punk/doc/commit/tools/index.html?id=94e429f914be777770cf8094d728008a5efcf6ff'>94e429f ^
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