Support _NET_WM_STATE_FOCUSED

_NET_WM_STATE_FOCUSED is set on _NET_WM_STATE to indicate that the
window is focused. It must be set when the window is newly focused and
removed once the window no longer has focus.

> _NET_WM_STATE_FOCUSED indicates whether the window's decorations are
> drawn in an active state. Clients MUST regard it as a read-only hint.
> It cannot be set at map time or changed via a _NET_WM_STATE client
> message.

For example, this is used by GTK applications to show the decoration in
an active or inactive state. This change can be tested by opening a GTK
application (like evince), focusing the window and unfocusing the
window, and observing a change in the window decorations.

Fixes #2273
This commit is contained in:
Tony Crisci
2016-07-24 20:43:56 -04:00
committed by Orestis Floros
parent 9cd4b53231
commit c42de09b1b
7 changed files with 117 additions and 3 deletions

View File

@ -284,6 +284,20 @@ void ewmh_update_sticky(xcb_window_t window, bool sticky) {
}
}
/*
* Set or remove _NEW_WM_STATE_FOCUSED on the window.
*
*/
void ewmh_update_focused(xcb_window_t window, bool is_focused) {
if (is_focused) {
DLOG("Setting _NET_WM_STATE_FOCUSED for window = %d.\n", window);
xcb_add_property_atom(conn, window, A__NET_WM_STATE, A__NET_WM_STATE_FOCUSED);
} else {
DLOG("Removing _NET_WM_STATE_FOCUSED for window = %d.\n", window);
xcb_remove_property_atom(conn, window, A__NET_WM_STATE, A__NET_WM_STATE_FOCUSED);
}
}
/*
* Set up the EWMH hints on the root window.
*