From 03af444735c8ab72382f0115552e410d8de04ca3 Mon Sep 17 00:00:00 2001 From: Nikolai Nechaev Date: Wed, 1 Jan 2025 11:28:05 +0300 Subject: [PATCH] Notifications: stop fading in before starting to fade out When a notification is to start hiding (i.e., fade out), it is supposed to start fading out from the maximum opacity, even if it was not fully restored (which only happens if the cursor passed through the notification too quickly). Thus, call `.stop()` for the previous animation, if any, before `.start()`ing the next animation. --- Telegram/SourceFiles/window/notifications_manager_default.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 5bf6f6099176d2..19d557e723663e 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -549,6 +549,10 @@ void Widget::hideStop() { void Widget::hideAnimated(float64 duration, const anim::transition &func) { _hiding = true; + // Stop the previous animation so as to make sure that the notification + // is fully restored before hiding it again. + // Relates to https://github.com/telegramdesktop/tdesktop/issues/28811. + _a_opacity.stop(); _a_opacity.start([this] { opacityAnimationCallback(); }, 1., 0., duration, func); }