plugins/nightlight: Make the slow transition more robust to fuzzy time values

If the slow transition is scheduled slightly earlier before m_next.first,
don't skip the "m_prev.first <= todayNow && todayNow <= m_prev.second" branch.

Also explicitly handle the case when resetSlowUpdateTimers() gets called
after m_prev.second, i.e. the previous transition has finished running.
wilder/Plasma/6.2
Vlad Zahorodnii 2 years ago
parent bbf4f46b28
commit 7880f879a3
  1. 4
      src/plugins/nightlight/nightlightmanager.cpp

@ -399,7 +399,7 @@ void NightLightManager::resetSlowUpdateTimers(const QDateTime &todayNow)
return;
}
if (m_prev.first <= todayNow && todayNow <= m_prev.second) {
if (todayNow < m_prev.second) {
int availTime = todayNow.msecsTo(m_prev.second);
m_slowUpdateTimer = std::make_unique<QTimer>();
m_slowUpdateTimer->setSingleShot(false);
@ -419,6 +419,8 @@ void NightLightManager::resetSlowUpdateTimers(const QDateTime &todayNow)
interval = 1;
}
m_slowUpdateTimer->start(interval);
} else {
commitGammaRamps(targetTemp);
}
}

Loading…
Cancel
Save