Support NET_WM_STATE_FOCUSED

Summary:
This is used by GTK clients to know whether to draw as though they have
focus or not. Whilst it's most visible for CSDs headers, use of the
active/inactive palette (or backdrop class in GTK terms) applies
everywhere.

Rationale of the flag is to allow the WM to hint visual states without
giving input, i.e so you can hint that the parent of a modal dialog
should be shown as active. Though kwin only sets it on the truly active
window to match the behaviour our other windows follow.

BUG: 398832

I expect this to be potentially controversial as it's new code in X11,
so in advance:

* Unlike GTK_FRAME_EXTENTS, it is part of the specificiation (albeit
1.4) even i3 supports it.

* It does fix a real world issue

* It's only 2 lines (plus trivial boiler plate in kwindowsystem)

* It's in code path that we rely on for our existing code

* If there's a situation where this does break, the worst that will
happen is a client gets a visual hint to have focus incorrectly, which
ultimately is the same as the current state

Test Plan:
Used my CSS for breeze-gtk
moved between windows

Reviewers: #kwin, rooty, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, ognarb, ngraham, rooty, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19613
This commit is contained in:
David Edmundson 2019-05-10 15:32:55 +01:00
parent 988ca97c96
commit ce1a5eae15
2 changed files with 3 additions and 1 deletions

View file

@ -824,6 +824,7 @@ xcb_timestamp_t Client::userTime() const
void Client::doSetActive()
{
updateUrgency(); // demand attention again if it's still urgent
info->setState(isActive() ? NET::Focused : NET::States(), NET::Focused);
}
void Client::startupIdChanged()

View file

@ -96,7 +96,8 @@ RootInfo *RootInfo::create()
NET::FullScreen |
NET::KeepBelow |
NET::DemandsAttention |
NET::SkipSwitcher;
NET::SkipSwitcher |
NET::Focused;
NET::Properties2 properties2 = NET::WM2UserTime |
NET::WM2StartupId |
NET::WM2AllowedActions |