Commit 6fd6179b authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

Honor animation brightness threshold also for sysfs helper

We should only animate the screen brightness if there are enough steps available
to make for a smooth transition. This check was forgotten for the new sysfs
brightness animation.

BUG: 426883
FIXED-IN: 5.20.0
parent aff74d38
......@@ -236,6 +236,12 @@ ActionReply BacklightHelper::setbrightness(const QVariantMap &args)
const int animationDuration = args.value(QStringLiteral("animationDuration")).toInt();
m_anim.stop();
if (animationDuration <= 0) {
writeBrightness(brightness);
return ActionReply::SuccessReply();
}
m_anim.setDuration(animationDuration);
m_anim.setStartValue(readBrightness());
m_anim.setEndValue(brightness);
......
......@@ -502,7 +502,9 @@ void PowerDevilUPowerBackend::setBrightness(int value, PowerDevil::BackendInterf
KAuth::Action action("org.kde.powerdevil.backlighthelper.setbrightness");
action.setHelperId(HELPER_ID);
action.addArgument("brightness", value);
action.addArgument("animationDuration", PowerDevilSettings::brightnessAnimationDuration());
if (brightnessMax() >= PowerDevilSettings::brightnessAnimationThreshold()) {
action.addArgument("animationDuration", PowerDevilSettings::brightnessAnimationDuration());
}
auto *job = action.execute();
connect(job, &KAuth::ExecuteJob::result, this, [this, job, value] {
if (job->error()) {
......
Markdown is supported
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