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

@ -55,6 +55,7 @@ subtest 'Window without WM_TAKE_FOCUS', sub {
my $window = open_window;
ok(!recv_take_focus($window), 'did not receive ClientMessage');
ok(is_net_wm_state_focused($window), '_NET_WM_STATE_FOCUSED set');
my ($nodes) = get_ws_content($ws);
my $con = shift @$nodes;
@ -91,6 +92,7 @@ subtest 'Window with WM_TAKE_FOCUS and without InputHint', sub {
$window->map;
ok(!recv_take_focus($window), 'did not receive ClientMessage');
ok(is_net_wm_state_focused($window), '_NET_WM_STATE_FOCUSED set');
my ($nodes) = get_ws_content($ws);
my $con = shift @$nodes;
@ -112,6 +114,7 @@ subtest 'Window with WM_TAKE_FOCUS and unspecified InputHint', sub {
my $window = open_window({ protocols => [ $take_focus ] });
ok(!recv_take_focus($window), 'did not receive ClientMessage');
ok(is_net_wm_state_focused($window), '_NET_WM_STATE_FOCUSED set');
my ($nodes) = get_ws_content($ws);
my $con = shift @$nodes;