From 89a8c6febabb31bdd65c3f76706bb2628f1fbc4c Mon Sep 17 00:00:00 2001 From: Nikolai Nechaev Date: Wed, 1 Jan 2025 13:21:34 +0300 Subject: [PATCH] Fix handling of notification disappearing under cursor Previously, notifications disappearing under cursor (e.g., because closed manually or open from another device) did not notify the manager properly, as the leaveEventHook was not triggered. This could lead to notifications staying around when not supposed to (see #28813). This commit fixes that by explicitly notifying manager when the notification widget disappears under the cursor. Fixes #28813. --- .../SourceFiles/window/notifications_manager_default.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 198418b585dbb..8ff3e2323deb6 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -500,7 +500,13 @@ void Widget::opacityAnimationCallback() { updateOpacity(); update(); if (!_a_opacity.animating() && _hiding) { - manager()->removeWidget(this); + if (underMouse()) { + // The notification is leaving from under the cursor, but in such case leave hook is not + // triggered automatically. But we still want the manager to start hiding notifications + // (see #28813). + manager()->startAllHiding(); + } + manager()->removeWidget(this); // Deletes `this` } }