comparison client.c @ 709:6c2fcf88dd9f

this variant is known to work, but focus() is ugly - we need in general a better way to handle multihead, this issel-stuff looks awkward (maybe it might be a good idea to set sel to NULL but to introduce a Client *revert which is set if a screen is unfocused, have to think about it further).
author Anselm R. Garbe <arg@suckless.org>
date Mon, 22 Jan 2007 10:35:58 +0100
parents a2d568a5cdb8
children b40134b93de3
comparison
equal deleted inserted replaced
708:a2d568a5cdb8 709:6c2fcf88dd9f
79 79
80 void 80 void
81 focus(Client *c) { 81 focus(Client *c) {
82 Client *old = sel; 82 Client *old = sel;
83 83
84 if(!issel || (c && !isvisible(c))) 84 if(c && !isvisible(c))
85 return; 85 return;
86 86
87 if(old && old != c) { 87 if(old && old != c) {
88 grabbuttons(old, False); 88 grabbuttons(old, False);
89 XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]); 89 XSetWindowBorder(dpy, old->win, dc.norm[ColBorder]);
90 } 90 }
91 if(c) { 91 if(c) {
92 detachstack(c); 92 if(issel) {
93 c->snext = stack; 93 detachstack(c);
94 stack = c; 94 c->snext = stack;
95 grabbuttons(c, True); 95 stack = c;
96 XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]); 96 grabbuttons(c, True);
97 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); 97 XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
98 } 98 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
99 else 99 }
100 else
101 XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
102 }
103 else if(issel)
100 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 104 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
101 sel = c; 105 sel = c;
102 drawstatus(); 106 drawstatus();
103 } 107 }
104 108