After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 700639 - messageTray: Don't allow opening the tray while a notification is active
messageTray: Don't allow opening the tray while a notification is active
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 698883 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-05-19 14:04 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2013-05-23 16:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
messageTray: Don't allow opening the tray while a notification is active (1.52 KB, patch)
2013-05-19 14:04 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
messageTray: Close any open notifications when using <Super>M (1.21 KB, patch)
2013-05-19 16:09 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
messageTray: Close any open notifications when using <Super>M (1.73 KB, patch)
2013-05-20 17:04 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
messageTray: Don't hide the tray for urgent notifications (1.14 KB, patch)
2013-05-20 18:08 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
messageTray: Remove some unused variables in _updateState (1.08 KB, patch)
2013-05-20 18:08 UTC, Jasper St. Pierre (not reading bugmail)
reviewed Details | Review
messageTray: Add a synonym for hasNotifications (2.94 KB, patch)
2013-05-20 18:08 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
messageTray: Hide notifications when the tray is summoned (2.53 KB, patch)
2013-05-20 18:08 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2013-05-19 14:04:16 UTC
If we press <Super>M while a notification is active, we should just fizzle
the request out rather than getting into a weird state where we defer
opening the tray but still try to focus it.
Comment 1 Jasper St. Pierre (not reading bugmail) 2013-05-19 14:04:21 UTC
Created attachment 244713 [details] [review]
messageTray: Don't allow opening the tray while a notification is active
Comment 2 Giovanni Campagna 2013-05-19 14:59:27 UTC
Review of attachment 244713 [details] [review]:

The fix is correct, but I believe it would make more sense to hide the notification immediately when you press super+M
Comment 3 Florian Müllner 2013-05-19 15:05:03 UTC
(In reply to comment #2)
> it would make more sense to hide the notification immediately 
> when you press super+M

I think so too - a notification just pops up, it shouldn't take precedence over explicit user action.
Comment 4 Jasper St. Pierre (not reading bugmail) 2013-05-19 16:09:41 UTC
Created attachment 244718 [details] [review]
messageTray: Close any open notifications when using <Super>M

If we don't do this, then we'll defer the tray opening until the
notification is closed naturally, which seems unexpected to the
user.
Comment 5 Giovanni Campagna 2013-05-20 16:27:31 UTC
Review of attachment 244718 [details] [review]:

::: js/ui/messageTray.js
@@ +2010,3 @@
     },
 
+    _toggle: function() {

Why the public to private rename?

@@ +2014,3 @@
             return false;
 
+        this._closeNotification();

_closeNotification doesn't handle SHOWING (and changing that would have dangerous side effects probably)
Comment 6 Jasper St. Pierre (not reading bugmail) 2013-05-20 16:36:19 UTC
(In reply to comment #5)
> Review of attachment 244718 [details] [review]:
> 
> ::: js/ui/messageTray.js
> @@ +2010,3 @@
>      },
> 
> +    _toggle: function() {
> 
> Why the public to private rename?

Because consumers that might want to call .toggle() probably don't want the new "close notification" behavior.

> @@ +2014,3 @@
>              return false;
> 
> +        this._closeNotification();
> 
> _closeNotification doesn't handle SHOWING (and changing that would have
> dangerous side effects probably)

And I don't want those dangerous side effects in the toggle method, alone, either. When the notification changes to SHOWN, _updateState() will be called, and the notification will be hidden and the tray eventually shown.
Comment 7 Giovanni Campagna 2013-05-20 16:46:56 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Review of attachment 244718 [details] [review] [details]:
> > 
> > ::: js/ui/messageTray.js
> > @@ +2010,3 @@
> >      },
> > 
> > +    _toggle: function() {
> > 
> > Why the public to private rename?
> 
> Because consumers that might want to call .toggle() probably don't want the new
> "close notification" behavior.

I believe consumers of .toggle() want "whatever <Super>M" does.

> > @@ +2014,3 @@
> >              return false;
> > 
> > +        this._closeNotification();
> > 
> > _closeNotification doesn't handle SHOWING (and changing that would have
> > dangerous side effects probably)
> 
> And I don't want those dangerous side effects in the toggle method, alone,
> either. When the notification changes to SHOWN, _updateState() will be called,
> and the notification will be hidden and the tray eventually shown.

No, if you don't handle SHOWING, then you're not fixing this bug: _updateState() will not go through _toggle() when the notification is shown, and it gives priority to notifications showing/shown vs _traySummoned.
Comment 8 Jasper St. Pierre (not reading bugmail) 2013-05-20 17:02:16 UTC
(In reply to comment #7)
> I believe consumers of .toggle() want "whatever <Super>M" does.

That's toggleAndNavigate() though. Perhaps we should just merge toggle() into toggleAndNavigate().
Comment 9 Jasper St. Pierre (not reading bugmail) 2013-05-20 17:04:05 UTC
Created attachment 244837 [details] [review]
messageTray: Close any open notifications when using <Super>M

If we don't do this, then we'll defer the tray opening until the
notification is closed naturally, which seems unexpected to the
user.



This is the best thing I could come up with. As a notification cannot
receive focus unless it is SHOWN, it cannot have a key release, nor
should the close button be visible. I tested for a few minutes to see
if I could trigger either "by accident", and couldn't find any, thus
modifying _closeNotification should be 100% safe.

The problem is that _closeNotification sets _notificationClosed back
to false right afterwards. So what's going to happen is that _updateState
will note that the notification is SHOWING, and not do anything, thus
it's like the notification was never closed. As a fix, we'll make
the _notificationClosed flag persistent until _hideNotification is
called as a result.
Comment 10 Giovanni Campagna 2013-05-20 17:13:12 UTC
Review of attachment 244837 [details] [review]:

Still doesn't work: it closes the current notification, but then _updateState() goes on with the next one in the queue.
Comment 11 Jasper St. Pierre (not reading bugmail) 2013-05-20 18:08:35 UTC
Created attachment 244849 [details] [review]
messageTray: Don't hide the tray for urgent notifications

The tray should never close on its own, without the user's input.
Comment 12 Jasper St. Pierre (not reading bugmail) 2013-05-20 18:08:39 UTC
Created attachment 244850 [details] [review]
messageTray: Remove some unused variables in _updateState
Comment 13 Jasper St. Pierre (not reading bugmail) 2013-05-20 18:08:42 UTC
Created attachment 244851 [details] [review]
messageTray: Add a synonym for hasNotifications

This prevents lines from getting too long.
Comment 14 Jasper St. Pierre (not reading bugmail) 2013-05-20 18:08:49 UTC
Created attachment 244852 [details] [review]
messageTray: Hide notifications when the tray is summoned

If the user summons the tray, it should take priority over a
notification showing.
Comment 15 Giovanni Campagna 2013-05-20 18:18:47 UTC
Review of attachment 244849 [details] [review]:

Ok
Comment 16 Giovanni Campagna 2013-05-20 18:19:19 UTC
Review of attachment 244850 [details] [review]:

Squash this.
Comment 17 Giovanni Campagna 2013-05-20 18:19:42 UTC
Review of attachment 244851 [details] [review]:

Ok
Comment 18 Giovanni Campagna 2013-05-20 18:22:28 UTC
Review of attachment 244852 [details] [review]:

Just a style fix.

::: js/ui/messageTray.js
@@ +2220,3 @@
         let notificationLockedOut = !hasNotifications && this._notification;
+        let notificationMustClose = this._notificationRemoved || notificationLockedOut || (notificationExpired && this._userActiveWhileNotificationShown) || this._notificationClosed || this._traySummoned;
+        let canShowNotification = notificationsPending && this._trayState == State.HIDDEN && !this._traySummoned;

Please wrap these.
Comment 19 Jasper St. Pierre (not reading bugmail) 2013-05-20 18:26:17 UTC
Attachment 244849 [details] pushed as d1c54f5 - messageTray: Don't hide the tray for urgent notifications
Attachment 244851 [details] pushed as d96726c - messageTray: Add a synonym for hasNotifications
Attachment 244852 [details] pushed as d5f95db - messageTray: Hide notifications when the tray is summoned
Comment 20 Jasper St. Pierre (not reading bugmail) 2013-05-23 16:03:26 UTC
*** Bug 698883 has been marked as a duplicate of this bug. ***