summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/client.c b/client.c
index 029a59c..2a981fc 100644
--- a/client.c
+++ b/client.c
@@ -28,17 +28,19 @@ next(Client *c)
28void 28void
29zoom(Arg *arg) 29zoom(Arg *arg)
30{ 30{
31 Client **l, *old; 31 Client **l;
32 32
33 if(!(old = sel)) 33 if(!sel)
34 return; 34 return;
35 35
36 if(sel == next(clients))
37 sel = next(sel->next);
38
36 for(l = &clients; *l && *l != sel; l = &(*l)->next); 39 for(l = &clients; *l && *l != sel; l = &(*l)->next);
37 *l = sel->next; 40 *l = sel->next;
38 41
39 old->next = clients; /* pop */ 42 sel->next = clients; /* pop */
40 clients = old; 43 clients = sel;
41 sel = old;
42 arrange(NULL); 44 arrange(NULL);
43 focus(sel); 45 focus(sel);
44} 46}
@@ -54,7 +56,6 @@ max(Arg *arg)
54 sel->h = sh - 2 * sel->border - bh; 56 sel->h = sh - 2 * sel->border - bh;
55 craise(sel); 57 craise(sel);
56 resize(sel, False); 58 resize(sel, False);
57 discard_events(EnterWindowMask);
58} 59}
59 60
60void 61void
@@ -65,9 +66,6 @@ view(Arg *arg)
65 tsel = arg->i; 66 tsel = arg->i;
66 arrange(NULL); 67 arrange(NULL);
67 68
68 if((c = next(clients)))
69 focus(c);
70
71 for(c = clients; c; c = next(c->next)) 69 for(c = clients; c; c = next(c->next))
72 draw_client(c); 70 draw_client(c);
73 draw_bar(); 71 draw_bar();
@@ -120,7 +118,6 @@ floating(Arg *arg)
120 focus(sel); 118 focus(sel);
121 } 119 }
122 } 120 }
123 discard_events(EnterWindowMask);
124} 121}
125 122
126void 123void
@@ -171,13 +168,12 @@ tiling(Arg *arg)
171 else 168 else
172 ban_client(c); 169 ban_client(c);
173 } 170 }
174 if(sel && !sel->tags[tsel]) { 171 if(!sel || (sel && !sel->tags[tsel])) {
175 if((sel = next(clients))) { 172 if((sel = next(clients))) {
176 craise(sel); 173 craise(sel);
177 focus(sel); 174 focus(sel);
178 } 175 }
179 } 176 }
180 discard_events(EnterWindowMask);
181} 177}
182 178
183void 179void
@@ -323,14 +319,16 @@ void
323focus(Client *c) 319focus(Client *c)
324{ 320{
325 Client *old = sel; 321 Client *old = sel;
322 XEvent ev;
326 323
324 XFlush(dpy);
327 sel = c; 325 sel = c;
328 if(old && old != c) 326 if(old && old != c)
329 draw_client(old); 327 draw_client(old);
330 draw_client(c); 328 draw_client(c);
331 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 329 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
332 XFlush(dpy); 330 XFlush(dpy);
333 discard_events(EnterWindowMask); 331 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
334} 332}
335 333
336static void 334static void