applied Andreas Amann's netwm_active_window patch, thx

This commit is contained in:
anselm@garbe.us 2012-03-25 17:46:03 +02:00
parent 1b62f8fa58
commit c1128417a9
1 changed files with 12 additions and 3 deletions

15
dwm.c
View File

@ -499,6 +499,7 @@ cleanup(void) {
cleanupmon(mons); cleanupmon(mons);
XSync(dpy, False); XSync(dpy, False);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); 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]); XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
setfocus(c); setfocus(c);
} }
else else {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
selmon->sel = c; selmon->sel = c;
drawbars(); drawbars();
} }
@ -1527,8 +1530,12 @@ sendevent(Client *c, Atom proto) {
void void
setfocus(Client *c) { 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; return;
grabbuttons(c, False); grabbuttons(c, False);
XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]); 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