summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@suckless.org>2007-01-22 10:35:58 +0100
committerAnselm R. Garbe <arg@suckless.org>2007-01-22 10:35:58 +0100
commitfcd98308ba65c8872b485ac7f1800841b0a29e5c (patch)
tree5a3edcf206d73c9135d3839d0c47b02a91c7d2db
parentapplied Sanders all5.patch (thanks for your weekend session, Sander!) (diff)
downloaddwm-fcd98308ba65c8872b485ac7f1800841b0a29e5c.tar.gz
dwm-fcd98308ba65c8872b485ac7f1800841b0a29e5c.zip
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).
Diffstat (limited to '')
-rw-r--r--client.c20
-rw-r--r--event.c2
2 files changed, 13 insertions, 9 deletions
diff --git a/client.c b/client.c
index 177eb94..510ec59 100644
--- a/client.c
+++ b/client.c
@@ -81,7 +81,7 @@ void
81focus(Client *c) { 81focus(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) {
@@ -89,14 +89,18 @@ focus(Client *c) {
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 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
99 }
100 else
101 XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
98 } 102 }
99 else 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();
diff --git a/event.c b/event.c
index e0718d3..2e021d5 100644
--- a/event.c
+++ b/event.c
@@ -269,8 +269,8 @@ leavenotify(XEvent *e) {
269 XCrossingEvent *ev = &e->xcrossing; 269 XCrossingEvent *ev = &e->xcrossing;
270 270
271 if((ev->window == root) && !ev->same_screen) { 271 if((ev->window == root) && !ev->same_screen) {
272 focus(NULL);
273 issel = False; 272 issel = False;
273 focus(sel);
274 } 274 }
275} 275}
276 276