diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-03-12 22:25:50 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-03-12 22:25:50 +1100 |
| commit | 4b18073e5cd90a140eb665de0020121b3b1cec36 (patch) | |
| tree | 13f6bd560783f058fadde7cddb1e9c36e6d763f1 /plugin | |
| parent | filesystemmodel: use static QMimeDatabase instance (diff) | |
| download | caelestia-shell-4b18073e5cd90a140eb665de0020121b3b1cec36.tar.gz caelestia-shell-4b18073e5cd90a140eb665de0020121b3b1cec36.tar.bz2 caelestia-shell-4b18073e5cd90a140eb665de0020121b3b1cec36.zip | |
circularindicator: guard signal emissions with change checks
Diffstat (limited to 'plugin')
| -rw-r--r-- | plugin/src/Caelestia/Internal/circularindicatormanager.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/plugin/src/Caelestia/Internal/circularindicatormanager.cpp b/plugin/src/Caelestia/Internal/circularindicatormanager.cpp index 434b756..2124997 100644 --- a/plugin/src/Caelestia/Internal/circularindicatormanager.cpp +++ b/plugin/src/Caelestia/Internal/circularindicatormanager.cpp @@ -153,8 +153,10 @@ void CircularIndicatorManager::updateRetreat(qreal progress) { spinRotation += m_curve.valueForProgress(getFractionInRange(playtime, spinDelay, DURATION_SPIN_IN_MS)) * SPIN_ROTATION_DEGREES; } + const auto oldRotation = m_rotation; m_rotation = constantRotation + spinRotation; - emit rotationChanged(); + if (!qFuzzyCompare(m_rotation + 1.0, oldRotation + 1.0)) + emit rotationChanged(); // Grow active indicator. qreal fraction = @@ -182,6 +184,8 @@ void CircularIndicatorManager::updateRetreat(qreal progress) { void CircularIndicatorManager::updateAdvance(qreal progress) { using namespace advance; const auto playtime = progress * TOTAL_DURATION_IN_MS; + const auto oldStart = m_startFraction; + const auto oldEnd = m_endFraction; // Adds constant rotation to segment positions. m_startFraction = CONSTANT_ROTATION_DEGREES * progress + TAIL_DEGREES_OFFSET; @@ -204,8 +208,10 @@ void CircularIndicatorManager::updateAdvance(qreal progress) { m_startFraction /= 360.0; m_endFraction /= 360.0; - emit startFractionChanged(); - emit endFractionChanged(); + if (!qFuzzyCompare(m_startFraction + 1.0, oldStart + 1.0)) + emit startFractionChanged(); + if (!qFuzzyCompare(m_endFraction + 1.0, oldEnd + 1.0)) + emit endFractionChanged(); } } // namespace caelestia::internal |