From 7880f879a330620d573bf04b7e1abe6207e51ede Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 17 May 2024 12:52:22 +0300 Subject: [PATCH] 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. --- src/plugins/nightlight/nightlightmanager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/nightlight/nightlightmanager.cpp b/src/plugins/nightlight/nightlightmanager.cpp index 62988725e4..df2344c090 100644 --- a/src/plugins/nightlight/nightlightmanager.cpp +++ b/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(); m_slowUpdateTimer->setSingleShot(false); @@ -419,6 +419,8 @@ void NightLightManager::resetSlowUpdateTimers(const QDateTime &todayNow) interval = 1; } m_slowUpdateTimer->start(interval); + } else { + commitGammaRamps(targetTemp); } }