comparison client.c @ 712:b288b57d81f8

this version should also work with cornercases (like unmanage during !issel, etc.)
author Anselm R. Garbe <arg@suckless.org>
date Tue, 23 Jan 2007 12:00:49 +0100
parents b40134b93de3
children ef2c267884f3
comparison
equal deleted inserted replaced
711:b40134b93de3 712:b288b57d81f8
77 XSendEvent(dpy, c->win, True, NoEventMask, &synev); 77 XSendEvent(dpy, c->win, True, NoEventMask, &synev);
78 } 78 }
79 79
80 void 80 void
81 focus(Client *c) { 81 focus(Client *c) {
82 Client *old = sel;
83
84 if(c && !isvisible(c)) 82 if(c && !isvisible(c))
85 return; 83 return;
86 84
87 if(old && old != c) { 85 if(sel && sel != c) {
88 grabbuttons(old, False); 86 grabbuttons(sel, False);
89 XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]); 87 XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
90 } 88 }
89 sel = c;
90 if(!issel)
91 return;
91 if(c) { 92 if(c) {
92 detachstack(c); 93 detachstack(c);
93 c->snext = stack; 94 c->snext = stack;
94 stack = c; 95 stack = c;
95 grabbuttons(c, True); 96 grabbuttons(c, True);
96 XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); 97 XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
97 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 98 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
98 } 99 }
99 else if(issel) 100 else
100 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 101 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
101 sel = c;
102 drawstatus(); 102 drawstatus();
103 } 103 }
104 104
105 Client * 105 Client *
106 getclient(Window w) { 106 getclient(Window w) {