[dev] [dwm] about _NET_ACTIVE_WINDOW support

From: Ivan Kanakarakis <ivan.kanak_AT_gmail.com>
Date: Sat, 7 Jan 2012 22:20:27 +0200

Hi all,

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.


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.
At this point I'm not sure if it's something wrong with dwm or with
chromium (I don't know yet, of other apps that behave that way). If anyone
has some idea about what could be wrong, please come forward.

  [0]:
http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#id2550738
  [1]: http://i.imgur.com/z4egU.png

thanks o/

-- 
*Ivan c00kiemon5ter V Kanakarakis *
Received on Sat Jan 07 2012 - 21:20:27 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 07 2012 - 21:24:04 CET