[gnome-shell] messageTray: Close SHOWING banner when its notification is destroyed



commit 2801d0bfe3ebd66fec76766d05133b327e498535
Author: Sebastian Keller <skeller gnome org>
Date:   Sun Dec 26 00:19:25 2021 +0100

    messageTray: Close SHOWING banner when its notification is destroyed
    
    Currently only banners in the SHOWN state are hidden when the underlying
    notification is destroyed, but if they are in the SHOWING state, they
    remain visible. Because the 'notification' member has already been set
    to null when the notification got destroyed, closing the banner by
    clicking on the close button, will not do anything and clicking on the
    notification itself will result in an error message. For notifications
    without a timeout, i.e. critical ones, this will result in an
    uncloseable notification.
    
    This can happen if the program creating a critical notification
    immediately closes it again, as might happen with power notifications
    from gnome-settings-daemon in some situations.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4855
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2079>

 js/ui/messageTray.js | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 8a5c262a99..8e403f308e 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1204,7 +1204,8 @@ var MessageTray = GObject.registerClass({
                 if (showNextNotification)
                     this._showNotification();
             }
-        } else if (this._notificationState == State.SHOWN) {
+        } else if (this._notificationState === State.SHOWING ||
+                   this._notificationState === State.SHOWN) {
             let expired = (this._userActiveWhileNotificationShown &&
                            this._notificationTimeoutId == 0 &&
                            this._notification.urgency != Urgency.CRITICAL &&
@@ -1215,10 +1216,12 @@ var MessageTray = GObject.registerClass({
             if (mustClose) {
                 let animate = hasNotifications && !this._notificationRemoved;
                 this._hideNotification(animate);
-            } else if (this._pointerInNotification && !this._banner.expanded) {
-                this._expandBanner(false);
-            } else if (this._pointerInNotification) {
-                this._ensureBannerFocused();
+            } else if (this._notificationState === State.SHOWN &&
+                       this._pointerInNotification) {
+                if (!this._banner.expanded)
+                    this._expandBanner(false);
+                else
+                    this._ensureBannerFocused();
             }
         }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]