comparison client.c @ 63:f14858218641

searching for a better way to discard enter notifies
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 13:03:53 +0200
parents 0a4b066ce254
children 50450aa24a46
comparison
equal deleted inserted replaced
62:0a4b066ce254 63:f14858218641
26 } 26 }
27 27
28 void 28 void
29 zoom(Arg *arg) 29 zoom(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
36 if(sel == next(clients))
37 sel = next(sel->next);
35 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 }
45 47
46 void 48 void
52 sel->y = sy + bh; 54 sel->y = sy + bh;
53 sel->w = sw - 2 * sel->border; 55 sel->w = sw - 2 * sel->border;
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
60 void 61 void
61 view(Arg *arg) 62 view(Arg *arg)
62 { 63 {
63 Client *c; 64 Client *c;
64 65
65 tsel = arg->i; 66 tsel = arg->i;
66 arrange(NULL); 67 arrange(NULL);
67
68 if((c = next(clients)))
69 focus(c);
70 68
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();
74 } 72 }
118 if((sel = next(clients))) { 116 if((sel = next(clients))) {
119 craise(sel); 117 craise(sel);
120 focus(sel); 118 focus(sel);
121 } 119 }
122 } 120 }
123 discard_events(EnterWindowMask);
124 } 121 }
125 122
126 void 123 void
127 tiling(Arg *arg) 124 tiling(Arg *arg)
128 { 125 {
169 i++; 166 i++;
170 } 167 }
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
183 void 179 void
184 prevc(Arg *arg) 180 prevc(Arg *arg)
185 { 181 {
321 317
322 void 318 void
323 focus(Client *c) 319 focus(Client *c)
324 { 320 {
325 Client *old = sel; 321 Client *old = sel;
326 322 XEvent ev;
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
336 static void 334 static void
337 init_tags(Client *c) 335 init_tags(Client *c)
338 { 336 {