Re: [dev] [dwm] about _NET_ACTIVE_WINDOW support

From: Anselm R Garbe <>
Date: Sun, 8 Jan 2012 12:28:11 +0100

On 7 January 2012 21:20, Ivan Kanakarakis <> wrote:
> I was going looking through dwm's code cause I've been having problems with
> my own implementation of _NET_ACTIVE_WINDOW support for mosnterwm, and
> noticed some things.
> 1) The ewmh standard on _NET_ACTIVE_WINDOW [0] says that:
>> [...] This is a read-only property set by the Window Manager. If a Client
>> wants to activate another window, it MUST send a _NET_ACTIVE_WINDOW client
>> message to the root window [...]
>> Depending on the information provided with the message, the Window Manager
>> may decide to refuse the request [...]
> dwm, when it receives a _NET_ACTIVE_WINDOW message, it transfers focus to
> the client that asked for it, but never sets the root window id to that
> window's id. That is ofcourse a choice - the standard doesn't force one to
> do that, but that makes tools like xdotool and xprop fail on some options
> that people may find usefull. Specifically the following commands:
>     $ xprop -root _NET_ACTIVE_WINDOW
>     $ xdotool getactivewindow
> To get those working properly, one would need to,
>     XChangeProperty(dpy, root, netatom[NetActiveWindow], XA_WINDOW, 32,
>                     PropModeReplace, (unsigned char *)&c->win, 1);
> everytime a new window is focused. I guess that would go into
> setfocus(Client *c) function or something similar.

Good point, I will consider this modification in dwm.

> 2) Apart from that, I get another weird focus(?) problem, that I get with
> dwm and monsterwm too, when I enable the _NET_ACTIVE_WINDOW support. If I go
> back some revisions before _NET_ACTIVE_WINDOW was added to dwm, everything
> seems right.
> It seems some apps (Chromium for me) don't get focused correctly. See
> this[1] to have a picture of what I'm talking about. Chromium, on the left
> and highlighted with the orange border, is supposed to be focused. Although
> it *has* input focus, and all keybinds, actions etc work, it *looks* like
> it's unfocused - the background on top is grey (the color above the green
> area with the tool/mail/bookmarks buttons) - when it should be black (thus
> indicating focus). That makes things like clicking the "star" to save a
> bookmark, not work correctly, as the popup that would ask where to place the
> bookmark, doesn't appear.
> Again, this happens on mosnterwm and dwm when _NET_ACTIVE_WINDOW is
> supported. I've tried many different things (eg sending a WM_TAKE_FOCUS
> event explicitly) but nothing seems to work.

Well WM_ shouldn't have any direct effect on the EWMH handling.

I have no idea at this point about your focus issue. My initial
thought when starting dwm development years ago was not supporting
EWMH at all, as it usually leads to all kinds of headaches like the
one you are describing and makes the code base messy. But I will look
into this issue to see if we find a proper solution.

Received on Sun Jan 08 2012 - 12:28:11 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 08 2012 - 12:36:04 CET