]> Skullheadx's Git Forge - dwm.git/commitdiff
fix not updating _NET_ACTIVE_WINDOW
authorNRK <nrk@disroot.org>
Thu, 12 Feb 2026 22:28:02 +0000 (22:28 +0000)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Fri, 13 Feb 2026 09:16:08 +0000 (10:16 +0100)
currently clients that set the input field of WM_HINTS to true
(c->neverfocus) will never be updated as _NET_ACTIVE_WINDOW even
when they are focused. according to the ICCCM [0] the input
field of WM_HINTS tells the WM to either use or not use
XSetInputFocus(), it shouldn't have any relation to
_NET_ACTIVE_WINDOW. EWMH spec [1] also does not mention any
relationship between the two.

this issue was noticed when launching games via steam/proton and
noticing that _NET_ACTIVE_WINDOW was always wrong/stale (i.e not
updated to the game window).

for reference I've looked at bspwm [2] and it also seems to set
_NET_ACTIVE_WINDOW regardless of whether the client has WM_HINTS
input true or not.

[0]: https://x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#input_focus
[1]: https://specifications.freedesktop.org/wm/1.5/ar01s03.html#id-1.4.10
[2]: https://github.com/baskerville/bspwm/blob/c5cf7d3943f9a34a5cb2bab36bf473fd77e7d4f6/src/tree.c#L659-L662

dwm.c

diff --git a/dwm.c b/dwm.c
index 53b393e62bff0981a85746537be71cb1e6b9b8e4..fc4232eb5f0552a6dcdc7123924116be6f881f66 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -1470,12 +1470,10 @@ sendevent(Client *c, Atom proto)
 void
 setfocus(Client *c)
 {
-       if (!c->neverfocus) {
+       if (!c->neverfocus)
                XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
-               XChangeProperty(dpy, root, netatom[NetActiveWindow],
-                       XA_WINDOW, 32, PropModeReplace,
-                       (unsigned char *) &(c->win), 1);
-       }
+       XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32,
+               PropModeReplace, (unsigned char *)&c->win, 1);
        sendevent(c, wmatom[WMTakeFocus]);
 }