JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
applied Andreas Amann's netwm_active_window patch, thx
authoranselm@garbe.us <unknown>
Sun, 25 Mar 2012 15:46:03 +0000 (17:46 +0200)
committeranselm@garbe.us <unknown>
Sun, 25 Mar 2012 15:46:03 +0000 (17:46 +0200)
dwm.c

diff --git a/dwm.c b/dwm.c
index 10b0d0d..95571f6 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -499,6 +499,7 @@ cleanup(void) {
                cleanupmon(mons);
        XSync(dpy, False);
        XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
                cleanupmon(mons);
        XSync(dpy, False);
        XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
+       XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
 }
 
 void
 }
 
 void
@@ -858,8 +859,10 @@ focus(Client *c) {
                XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
                setfocus(c);
        }
                XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
                setfocus(c);
        }
-       else
+       else {
                XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
                XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+               XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
+       }
        selmon->sel = c;
        drawbars();
 }
        selmon->sel = c;
        drawbars();
 }
@@ -1527,8 +1530,12 @@ sendevent(Client *c, Atom proto) {
 
 void
 setfocus(Client *c) {
 
 void
 setfocus(Client *c) {
-       if(!c->neverfocus)
+       if(!c->neverfocus) {
                XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
                XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
+               XChangeProperty(dpy, root, netatom[NetActiveWindow],
+                               XA_WINDOW, 32, PropModeReplace,
+                               (unsigned char *) &(c->win), 1);
+       }
        sendevent(c, wmatom[WMTakeFocus]);
 }
 
        sendevent(c, wmatom[WMTakeFocus]);
 }
 
@@ -1786,8 +1793,10 @@ unfocus(Client *c, Bool setfocus) {
                return;
        grabbuttons(c, False);
        XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
                return;
        grabbuttons(c, False);
        XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
-       if(setfocus)
+       if(setfocus) {
                XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
                XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+               XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
+       }
 }
 
 void
 }
 
 void