From ce1a5eae156a544da06a9a37ee00b6b55dd13bb3 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 10 May 2019 15:32:55 +0100 Subject: [PATCH] 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 --- activation.cpp | 1 + netinfo.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/activation.cpp b/activation.cpp index 9029224e91..397cc71445 100644 --- a/activation.cpp +++ b/activation.cpp @@ -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() diff --git a/netinfo.cpp b/netinfo.cpp index 2838060143..d26061799b 100644 --- a/netinfo.cpp +++ b/netinfo.cpp @@ -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 |