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 610726 - Message Tray: Summary on Hover
Message Tray: Summary on Hover
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on: 604943
Blocks:
 
 
Reported: 2010-02-22 19:51 UTC by Jonathan Strander
Modified: 2010-03-25 13:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Notification Popup Mockup (339.89 KB, image/jpeg)
2010-02-22 19:57 UTC, Jonathan Strander
  Details
[MessageTray] fix so you don't see the bottom rounded corners on pop-out (2.17 KB, patch)
2010-03-15 19:56 UTC, Dan Winship
none Details | Review
[StClickable] return FALSE, not TRUE from enter/leave event handlers (1.55 KB, patch)
2010-03-15 19:56 UTC, Dan Winship
none Details | Review
[MessageTray] Use St.Clickable rather than tracking enter/leave events (6.06 KB, patch)
2010-03-15 19:56 UTC, Dan Winship
reviewed Details | Review
[MessageTray] pop out the last notification when mousing over the summary (11.08 KB, patch)
2010-03-15 19:57 UTC, Dan Winship
reviewed Details | Review
[StWidget] add (optional) hover tracking (16.97 KB, patch)
2010-03-23 18:35 UTC, Dan Winship
committed Details | Review
[MessageTray] Use #StWidget:track-hover (5.02 KB, patch)
2010-03-23 18:35 UTC, Dan Winship
committed Details | Review
[MessageTray] remove bottom rounded corners (1.02 KB, patch)
2010-03-23 18:35 UTC, Dan Winship
committed Details | Review
[MessageTray] pop out the last notification when mousing over the summary (11.05 KB, patch)
2010-03-23 18:35 UTC, Dan Winship
committed Details | Review
don't show same notification as both main and summary notification (1.54 KB, patch)
2010-03-24 18:57 UTC, Dan Winship
committed Details | Review

Description Jonathan Strander 2010-02-22 19:51:29 UTC
Messages/Notifications remaining in the tray should always show a summary on mouse hover.

Example in attachment:

*Received 2 IMs from Pidgin. 
*Try to determine if response required from either message, but can't accurately recall message content.
*Hovering over icon shows received message.

Justification:
User should not have to navigate away from current workspace/activity to review notifications whenever possible.
Comment 1 Jonathan Strander 2010-02-22 19:57:06 UTC
Created attachment 154434 [details]
Notification Popup Mockup

Original attachment missing.
Comment 2 Dan Winship 2010-03-15 19:56:11 UTC
Created attachment 156212 [details] [review]
[MessageTray] fix so you don't see the bottom rounded corners on pop-out

the problem is only barely noticeable with ordinary notifications, but
we'll be using the same hack to add extra height to the summary area
notifications so that they can extend through the tray area to the
bottom of the screen
Comment 3 Dan Winship 2010-03-15 19:56:37 UTC
Created attachment 156213 [details] [review]
[StClickable] return FALSE, not TRUE from enter/leave event handlers

This lets the clickable's parents also process the event. In
particular, this fixes the tracking of "hover" when you leave one
StClickable by passing through one of its StClickable children.

--

pretty sure this is correct. I couldn't find anything about why it was
returning TRUE rather than FALSE before
Comment 4 Dan Winship 2010-03-15 19:56:53 UTC
Created attachment 156214 [details] [review]
[MessageTray] Use St.Clickable rather than tracking enter/leave events

St.Clickable's "hover" property takes reactive children into account
when deciding whether or not the pointer has actually left the actor.
Rather than duplicating that logic here, just rewrite it to use
St.Clickable.

Changing MessageTray.actor from an St.BoxLayout to an St.Bin subclass
requires tweaking the allocation of notificationBin and summaryBin
slightly; The new system uses anchor_gravity to keep them aligned
correctly.
Comment 5 Dan Winship 2010-03-15 19:57:04 UTC
Created attachment 156215 [details] [review]
[MessageTray] pop out the last notification when mousing over the summary
Comment 6 Owen Taylor 2010-03-15 20:28:12 UTC
Review of attachment 156213 [details] [review]:

In general, I would expect enter/leave handlers to return FALSE rather than true in most cases - we are observing the event rather than acting on the event. But its a little uncomfortable if StClickable breaks if any of the children get the return value wrong. Would it work to track the hover state in captured-event?
Comment 7 Florian Müllner 2010-03-18 10:49:28 UTC
Review of attachment 156212 [details] [review]:

I'm not too comfortable with that change, especially as it restricts the bottom padding to the left padding (the comment in the CSS is not very clear about that). Not sure if non-uniform border-radii are still part of bug 607500, but that seems like the way to go (also see .panel-button) - meanwhile you could use something like Math.max(radius[St.Corner.BOTTOM_LEFT], radius[St.Corner.BOTTOM_RIGHT]) in the height calculation.
Comment 8 Florian Müllner 2010-03-18 11:35:18 UTC
Review of attachment 156214 [details] [review]:

The patch breaks notification actions, probably due to general St.Button brokenness - if you don't feel like fixing St.Button (heh), you can use St.Clickable for actions as well.

I wonder if we'd want to move the hover property from St.Clickable into St.Widget eventually - I already added hover support to St.Entry, now here's a case where we'd like to have it in St.BoxLayout: the MessageTray.actor change ("Box + hover") resembles a little the St.BoxLayout abuse elsewhere ("Clutter.Group + CSS").

The rest of the patch feels like a nice cleanup (especially where you change _summaryBin from Box to Bin - ugggh).
Comment 9 Florian Müllner 2010-03-18 14:09:45 UTC
(In reply to comment #8)
The patch breaks clicks on the notification icon as well.
Comment 10 Florian Müllner 2010-03-18 14:19:00 UTC
Review of attachment 156215 [details] [review]:

Looks good overall!

Currently it is possible for both "normal" and summary notifications to show up simultaneously, which looks overly busy on small screens - not sure we want this.

That said, there's not too much to say:

::: js/ui/messageTray.js
@@ +395,2 @@
         this._summaryBin.opacity = 0;
+        this._summaryNotificationBin = new St.Clickable({ name: 'notification-box',

The style id is currently unused? Would it make sense to make this a style class instead and use the same on this._notificationBin?

@@ +867,3 @@
+    _showSummaryNotification: function() {
+
+    },

// See previous review

::: js/ui/notificationDaemon.js
@@ -361,3 @@
-            this.handleReplacing = false;
-        if (app.get_name() == EMPATHY)
-

Looks unrelated to this patch.
Comment 11 Dan Winship 2010-03-18 19:02:34 UTC
(In reply to comment #10)
> Currently it is possible for both "normal" and summary notifications to show up
> simultaneously, which looks overly busy on small screens - not sure we want
> this.

that's currently called for in the design. we probably need some sort of separation between them though rather than having the two black backgrounds just bleed into each other. i figured Jon and Jeremy would have further refinements after we got the initial version in.
Comment 12 Dan Winship 2010-03-23 14:29:04 UTC
(In reply to comment #6)
> its a little uncomfortable if StClickable breaks if any of the
> children get the return value wrong. Would it work to track the hover state in
> captured-event?

Not if one of its ancestors got the return value of captured-event wrong. :) I don't think we need to be second-guessing the semantics of event handling here. If the child wants to keep the parent from knowing that the pointer is hovering over it, then it can do it. If it didn't want to do that but got the return value wrong, then it's just a bug and needs to be fixed.


I mentioned has-pointer yesterday, but it turns out that that is only set on the innermost reactive actor, and it still doesn't work the way we want wrt grabs. If we want to be able to update hover automatically after a pointer grab (qv bug 609802), we'd need to create our own grab framework with grab-end notification, and use that consistently everywhere in the shell rather than using clutter_grab_pointer() directly.
Comment 13 Dan Winship 2010-03-23 18:35:25 UTC
Created attachment 156904 [details] [review]
[StWidget] add (optional) hover tracking

If track-hover is set, update the hover property automatically, and
the "hover" pseudo class to match, as StClickable used to do. (Remove
the corresponding code in StClickable). Tweak the tooltip handling to
use track-hover, which also makes it slightly more reliable in the
presence of reactive children, etc.
Comment 14 Dan Winship 2010-03-23 18:35:37 UTC
Created attachment 156906 [details] [review]
[MessageTray] Use #StWidget:track-hover

St.Widget's new "hover" property takes reactive children into account
when deciding whether or not the pointer has actually left the actor,
so it works better than the code that used to be here.
Comment 15 Dan Winship 2010-03-23 18:35:48 UTC
Created attachment 156907 [details] [review]
[MessageTray] remove bottom rounded corners
Comment 16 Dan Winship 2010-03-23 18:35:56 UTC
Created attachment 156908 [details] [review]
[MessageTray] pop out the last notification when mousing over the summary
Comment 17 Owen Taylor 2010-03-23 19:36:31 UTC
Review of attachment 156904 [details] [review]:

Looks good to me other than style niggles. Not completely sold on the event-bubbling vs. capture thing - it seems to me that there's a much stronger responsibility to think about the whole picture when you are capturing events, but we can try it this way and see how much time we spend whack-a-moling enter/leave event returns :-). In many cases people probably should be using notify::hover instead in any case.

::: src/st/st-clickable.c
@@ +85,3 @@
 {
   StClickable *self = ST_CLICKABLE (actor);
+  gboolean ret;

'gboolean result' is currently beating 'gboolean ret' in ST by 5:1.

@@ +93,2 @@
   if (self->priv->held)
+    set_pressed (self, st_widget_get_hover (ST_WIDGET (actor)));

TRUE would seem clearer than get_hover()

@@ +112,2 @@
+  if (self->priv->held)
+    set_pressed (self, st_widget_get_hover (ST_WIDGET (actor)));

Similarly here FALSE would seem clearer than get_hover()

::: src/st/st-widget.c
@@ +1146,3 @@
 static gboolean
+st_widget_contains (ClutterActor *widget,
+                    ClutterActor *other)

If this was a StWidget method (even static), I'd expect it to take a StWidget argument... I think I'd just call it 'actor_contains()' or something like that - most of the static functions in StWidget aren't st_widget_*.

@@ +1162,3 @@
+    {
+      if (st_widget_contains (actor, event->source))
+        st_widget_set_hover ((StWidget*) actor, TRUE);

My feelings on ad-hoc "checked casts aren't fast enough" optimizations are well known, I think. There's a #define if we think that's the case.

@@ +2029,3 @@
+ * st_widget_set_track_hover:
+ * @widget: A #StWidget
+ * @track_hover: #TRUE if the widget should track the pointer hover state

%TRUE not #TRUE

@@ +2054,3 @@
+  priv = widget->priv;
+
+  if (priv->track_hover != track_hover)

gboolean setter should have a 'track_hover = track_hover != FALSE'

@@ +2092,3 @@
+ * If you have set #StWidget:track-hover, you should not need to
+ * call this directly. Use st_widget_sync_hover() if you need to
+ * manually track hover due to a pointer grab.

I don't think that's manually tracking hover. "if you need to get hover tracking back into sync after a pointer grab disturbs tracking" or something.

@@ +2104,3 @@
+  priv = widget->priv;
+
+  if (priv->hover != hover)

Similarly should have the != FALSE
Comment 18 Florian Müllner 2010-03-23 19:54:26 UTC
(In reply to comment #13)
> If track-hover is set, update the hover property automatically, and
> the "hover" pseudo class to match, as StClickable used to do. (Remove
> the corresponding code in StClickable).

Should the corresponding code in StEntry and StButton be adapted as well?
Comment 19 Dan Winship 2010-03-23 19:57:14 UTC
(In reply to comment #17)
> TRUE would seem clearer than get_hover()

> Similarly here FALSE would seem clearer than get_hover()

it's possible for hover to be FALSE after an enter event or TRUE after a leave event (if we have a grab and this was actually someone else's event, or if we left into a child).
Comment 20 Owen Taylor 2010-03-23 21:07:33 UTC
(In reply to comment #19)
> (In reply to comment #17)
> > TRUE would seem clearer than get_hover()
> 
> > Similarly here FALSE would seem clearer than get_hover()
> 
> it's possible for hover to be FALSE after an enter event or TRUE after a leave
> event (if we have a grab and this was actually someone else's event, or if we
> left into a child).

Needs a comment then. (and/or maybe factor the if (pressed) ... into an _update() function)
Comment 21 Florian Müllner 2010-03-24 09:30:13 UTC
Review of attachment 156907 [details] [review]:

::: data/theme/gnome-shell.css
@@ +667,3 @@
+     * if the background is a gradient. So, we draw a gradient
+    /* FIXME: currently StWidget can only draw non-uniform corners
+    border-radius: 5px 5px 0px 0px;

I'm pretty sure that this won't work if you leave out background-gradient-direction
Comment 22 Florian Müllner 2010-03-24 09:38:30 UTC
Review of attachment 156906 [details] [review]:

Very nice cleanup.
Comment 23 Florian Müllner 2010-03-24 10:44:30 UTC
Review of attachment 156908 [details] [review]:

Overall looks good - there is a problem when hovering over a source while it has a notification popped out (or the opposite of a notification popping out while hovering over its source): the same notification is displayed twice (either _both_ bottom center or _both_ bottom right, seems more or less random)
Comment 24 Dan Winship 2010-03-24 14:09:18 UTC
(In reply to comment #17)
> My feelings on ad-hoc "checked casts aren't fast enough" optimizations are well
> known, I think. There's a #define if we think that's the case.

I've changed it, but that code was just copied here from StClickable.

> +  if (priv->track_hover != track_hover)
> 
> gboolean setter should have a 'track_hover = track_hover != FALSE'

That was also just copied code. (from st_widget_set_has_tooltip). The only place in all of st where we currently do "!= FALSE" is st_scroll_view_set_vshadows(). I'm going to leave this matching everything else for now and we can fix all of St later. (There are also a lot of missing g_object_notify()s.)

> I don't think that's manually tracking hover. "if you need to get hover
> tracking back into sync after a pointer grab disturbs tracking" or something.

yeah... half the sentence got rewritten and half didn't :)
Comment 25 Dan Winship 2010-03-24 14:14:44 UTC
Attachment 156906 [details] pushed as 994b4c0 - [MessageTray] Use #StWidget:track-hover
Attachment 156907 [details] pushed as 68b943d - [MessageTray] remove bottom rounded corners
Comment 26 Dan Winship 2010-03-24 18:57:25 UTC
Created attachment 157008 [details] [review]
don't show same notification as both main and summary notification

addendum to previous patch to fix that problem
Comment 27 Florian Müllner 2010-03-24 22:53:30 UTC
(In reply to comment #26)
> Created an attachment (id=157008) [details] [review]
> don't show same notification as both main and summary notification
> 
> addendum to previous patch to fix that problem

I wonder if it makes sense (sometime, not now) to set the hover notification after the "regular" notification popped in - IMO this would stress the impression of notifications "moving" into the summary after timing out ...

Patches look good to me, may make sense to squash the second one before committing.
Comment 28 Dan Winship 2010-03-25 13:26:34 UTC
squashed, merged, pushed

Attachment 156908 [details] pushed as ac54fed - [MessageTray] pop out the last notification when mousing over the summary