Skip to content

actions/dpms: Ignore turn-off triggers when action is disabled

Early Plasma 6.0 releases saw many people reporting unintentional screen turn-off when the screen locker activates/deactivates, and when the system wakes up from sleep. On X11, this was visible to the user immediately, whereas on Wayland it spammed system logs with warnings of invalid -1 idle timeout registrations.

Ironically, this behavior would occur specifically when the DPMS action (a.k.a. "When locked, turn screen off") was disabled.

The reason is that the DPMS object gets created either way, and sets up its screen locker activation change handler as well as suspend/resume handlers in the constructor. But timeout values can remain invalid until the action is loaded/enabled and timeout values are populated from profile settings. Using invalid timeouts in these handlers caused this headache.

This bug was introduced by commit c58085b4, which fixed a bunch of things, bug also removed checks for invalid timeout values. Turns out we still need some kind of checks.

We now prevent bad timeout registrations by interpreting negative values in m_idleTimeoutWhenUnlocked as "idle timeout disabled". Checks for this value ensure that registerIdleTimeout() is only called when the action is loaded, regardless of whether it's triggered by screen locker changing its activation status, resume after suspend, or any other event.

Alternatively, we could have also moved some signal connections into loadAction() and disconnected them in onProfileUnload(). Checking on every registration call seems more robust though

BUG: 481308 BUG: 482077


Plus extra commit in the same file: Add new logs to make future debugging easier

Edited by Jakob Petsovits

Merge request reports