[plasma/kwin/Plasma/6.6] src: x11window: also take screen locking and dpms into account for visibility

Xaver Hugl <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 578d3ba50215a018ee342a95397d3bb3b5c5eb8e by Xaver Hugl.
Committed on 27/07/2026 at 11:44.
Pushed by zamundaaa into branch 'Plasma/6.6'.

x11window: also take screen locking and dpms into account for visibility

Many games break when they get throttled too much, which so far happened when
the screen is locked or dpms off.

For screen locking, this only sets the window to "keep" mode, since the flicker
that happens when some X11 apps get mapped again is quite visible there.
For dpms off though, the modeset time and animations ensure you can't see that
flicker, so we can unmap the window completely. Well-behaved apps should then
stop rendering until the screen is turned on again.

(cherry picked from commit a0d90f1fdc201f77571e44dfedc505726d932484)

M  +4    -2    src/x11window.cpp

https://invent.kde.org/plasma/kwin/-/commit/578d3ba50215a018ee342a95397d3bb3b5c5eb8e

diff --git a/src/x11window.cpp b/src/x11window.cpp
index 2367aab46b2..4f603e2283f 100644
--- a/src/x11window.cpp
+++ b/src/x11window.cpp
@@ -136,6 +136,8 @@ X11Window::X11Window()
 
     connect(clientMachine(), &ClientMachine::localhostChanged, this, &X11Window::updateCaption);
     connect(options, &Options::condensedTitleChanged, this, &X11Window::updateCaption);
+    connect(workspace(), &Workspace::dpmsStateChanged, this, &X11Window::updateVisibility);
+    connect(waylandServer(), &WaylandServer::lockStateChanged, this, &X11Window::updateVisibility);
 
     m_releaseTimer.setSingleShot(true);
     connect(&m_releaseTimer, &QTimer::timeout, this, [this]() {
@@ -1176,13 +1178,13 @@ void X11Window::updateVisibility()
         return;
     }
     setSkipTaskbar(originalSkipTaskbar()); // Reset from 'hidden'
-    if (isMinimized()) {
+    if (isMinimized() || workspace()->dpmsState() != Workspace::DpmsState::On) {
         info->setState(NET::Hidden, NET::Hidden);
         internalHide();
         return;
     }
     info->setState(NET::States(), NET::Hidden);
-    if (!isOnCurrentDesktop()) {
+    if (!isOnCurrentDesktop() || waylandServer()->isScreenLocked()) {
         internalKeep();
         return;
     }
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.