Skip to content
Commit a150b9fa authored by Jakob Petsovits's avatar Jakob Petsovits Committed by Nicolas Fella
Browse files

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
(cherry picked from commit be2b8361)
parent ae9af8fe
Pipeline #628407 passed with stage
in 1 minute and 56 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment