[plasma/kwin] src: x11: Treat "globally active" model as "no input" model

Vlad Zahorodnii <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 9dc4dae4d7038ff65e0d7b2cb7d39f12060110fc by Vlad Zahorodnii.
Committed on 17/08/2026 at 09:31.
Pushed by vladz into branch 'master'.

x11: Treat "globally active" model as "no input" model

The ICCCM spec defines four input models depending on the input hint in
WM_HINTS and whether the WM_TAKE_FOCUS protocol is supported.

The "globally active" input model rather causes issues because a good
proportion of clients doesn't actually opt-in into it intentionally.
They announce the WM_TAKE_FOCUS protocol in WM_PROTOCOLS and then sync
the input hint in WM_HINTS with whether the given window wants focus.
In some cases, the WM_TAKE_FOCUS is announced due to being historical
leftover; in other cases, the toolkit handles take focus messages but
it is rather to call XSetInputFocus() for the given window (i.e. the
toolkit doesn't apply any custom policies at all) or implement some kind
of nested modal dialogs (Qt). None of the usecases really need the
globally active input model.

So this change makes kwin only check the input hint in WM_HINTS. It
helps us to avoid async focus shenaginans and keep the relevant code
simple.

M  +5    -1    src/x11window.cpp

https://invent.kde.org/plasma/kwin/-/commit/9dc4dae4d7038ff65e0d7b2cb7d39f12060110fc

diff --git a/src/x11window.cpp b/src/x11window.cpp
index ba55ac83dc6..9584cf538ec 100644
--- a/src/x11window.cpp
+++ b/src/x11window.cpp
@@ -1946,7 +1946,11 @@ void X11Window::sendSyncRequest()
 
 bool X11Window::wantsInput() const
 {
-    return rules()->checkAcceptFocus(acceptsFocus() || info->supportsProtocol(NET::TakeFocusProtocol)) && isClient();
+    // Not checking whether the WM_TAKE_FOCUS is supported because many clients not wishing
+    // to accept any input at all only unset the input flag in WM_HINTS and leave WM_TAKE_FOCUS,
+    // which then leads to focus management issues that need to be worked around by adding
+    // window type checks, etc. Avoiding async focus also helps with keeping the code simple.
+    return rules()->checkAcceptFocus(acceptsFocus());
 }
 
 bool X11Window::acceptsFocus() const
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.