Commit 0692107b authored by Oliver Henshaw's avatar Oliver Henshaw
Browse files

Prevent button action from enabling disabled DPMS

Button actions call triggerImpl, which leaves DPMS enabled. It can't be
disabled until return from idle, as that would wake the screen. Solve
this by explicitly setting DPMS timeouts to zero when DPMS is meant to
be disabled - i.e. when unloading the action or when screen power
management is inhibited.

CCBUG: 295164
REVIEW: 106794
parent 7626961a
......@@ -122,6 +122,7 @@ void PowerDevilDPMSAction::onProfileUnload()
} else {
kDebug() << "Not performing DPMS action due to inhibition";
DPMSSetTimeouts(dpy, 0, 0, 0);
void PowerDevilDPMSAction::onWakeupFromIdle()
......@@ -189,6 +190,9 @@ void PowerDevilDPMSAction::triggerImpl(const QVariantMap& args)
DPMSForceLevel(dpy, DPMSModeSuspend);
// this leaves DPMS enabled but if it's meant to be disabled
// then the timeouts will be zero and so effectively disabled
bool PowerDevilDPMSAction::loadAction(const KConfigGroup& config)
......@@ -210,7 +214,8 @@ void PowerDevilDPMSAction::onUnavailablePoliciesChanged(PowerDevil::PolicyAgent:
// Inhibition triggered: disable DPMS
kDebug() << "Disabling DPMS due to inhibition";
Display *dpy = QX11Info::display();
DPMSSetTimeouts(dpy, 0, 0, 0);
DPMSDisable(dpy); // wakes the screen - do we want this?
} else {
// Inhibition removed: let's start again
Supports Markdown
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