From 62589d31edce363dbac5171bf656806e2a0499a1 Mon Sep 17 00:00:00 2001 From: Nikolai Nechaev Date: Thu, 2 Jan 2025 17:49:58 +0300 Subject: [PATCH] `Manager::startAllHiding`: don't treat fading in notifications differently Previously, `Window::Notifications::Default::Manager` would not start hiding notifications that are fading in when other notifications should hide. This would lead to some notifications never hiding, e.g., when the cursor passes through the notification too quickly and there was not enough time for the notification to fade in completely. Also renamed `Widget::isShowing` -> `Widget::isFadingIn` for clarity. Fixes #28811. --- .../window/notifications_manager_default.cpp | 10 ++-------- .../SourceFiles/window/notifications_manager_default.h | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 198418b585dbb..c46b013d6e29f 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -188,16 +188,10 @@ void Manager::checkLastInput() { void Manager::startAllHiding() { if (!hasReplyingNotification()) { - int notHidingCount = 0; for (const auto ¬ification : _notifications) { - if (notification->isShowing()) { - ++notHidingCount; - } else { - notification->startHiding(); - } + notification->startHiding(); } - notHidingCount += _queuedNotifications.size(); - if (_hideAll && notHidingCount < 2) { + if (_hideAll && _queuedNotifications.size() < 2) { _hideAll->startHiding(); } } diff --git a/Telegram/SourceFiles/window/notifications_manager_default.h b/Telegram/SourceFiles/window/notifications_manager_default.h index 5bd4344d8db4a..7c81282355e7b 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.h +++ b/Telegram/SourceFiles/window/notifications_manager_default.h @@ -143,7 +143,7 @@ class Widget : public Ui::RpWidget { int shift, Direction shiftDirection); - bool isShowing() const { + bool isFadingIn() const { return _a_opacity.animating() && !_hiding; }