[plasma/kwin] 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 a0d90f1fdc201f77571e44dfedc505726d932484 by Xaver Hugl.
Committed on 27/07/2026 at 10:26.
Pushed by zamundaaa into branch 'master'.
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.
M +4 -2 src/x11window.cpp
https://invent.kde.org/plasma/kwin/-/commit/a0d90f1fdc201f77571e44dfedc505726d932484
diff --git a/src/x11window.cpp b/src/x11window.cpp
index eb996b881ab..ba55ac83dc6 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);
// SELI TODO: Initialize xsizehints??
}
@@ -1234,13 +1236,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;
}