summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/client.c b/client.c
index 586a87f..3578beb 100644
--- a/client.c
+++ b/client.c
@@ -11,6 +11,14 @@
11/* static functions */ 11/* static functions */
12 12
13static void 13static void
14detachstack(Client *c)
15{
16 Client **tc;
17 for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
18 *tc = c->snext;
19}
20
21static void
14grabbuttons(Client *c, Bool focus) 22grabbuttons(Client *c, Bool focus)
15{ 23{
16 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); 24 XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
@@ -99,6 +107,9 @@ focus(Client *c)
99 } 107 }
100 } 108 }
101 if(c) { 109 if(c) {
110 detachstack(c);
111 c->snext = stack;
112 stack = c;
102 grabbuttons(c, True); 113 grabbuttons(c, True);
103 drawtitle(c); 114 drawtitle(c);
104 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 115 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
@@ -198,7 +209,6 @@ killclient(Arg *arg)
198void 209void
199manage(Window w, XWindowAttributes *wa) 210manage(Window w, XWindowAttributes *wa)
200{ 211{
201 unsigned int i;
202 Client *c; 212 Client *c;
203 Window trans; 213 Window trans;
204 XSetWindowAttributes twa; 214 XSetWindowAttributes twa;
@@ -247,7 +257,8 @@ manage(Window w, XWindowAttributes *wa)
247 if(clients) 257 if(clients)
248 clients->prev = c; 258 clients->prev = c;
249 c->next = clients; 259 c->next = clients;
250 clients = c; 260 c->snext = stack;
261 stack = clients = c;
251 262
252 settitle(c); 263 settitle(c);
253 ban(c); 264 ban(c);
@@ -421,6 +432,7 @@ unmanage(Client *c)
421 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); 432 XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
422 XDestroyWindow(dpy, c->twin); 433 XDestroyWindow(dpy, c->twin);
423 434
435 detachstack(c);
424 free(c->tags); 436 free(c->tags);
425 free(c); 437 free(c);
426 438