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 610670 - [MessageTray] Support reactive notification actors
[MessageTray] Support reactive notification actors
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: 610796
 
 
Reported: 2010-02-22 10:27 UTC by drago01
Modified: 2010-03-24 17:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[MessageTray] Support reactive notification actors (1.60 KB, patch)
2010-02-22 10:28 UTC, drago01
none Details | Review
[MessageTray] Support reactive notification actors (2.33 KB, patch)
2010-02-25 15:43 UTC, drago01
reviewed Details | Review

Description drago01 2010-02-22 10:27:55 UTC
Use captured-event and check for the event type rather than using
enter-event and leave-event to allow actors added by Notification.addActor to be reactive.
Comment 1 drago01 2010-02-22 10:28:22 UTC
Created attachment 154369 [details] [review]
[MessageTray] Support reactive notification actors
Comment 2 drago01 2010-02-25 15:43:57 UTC
Created attachment 154695 [details] [review]
[MessageTray] Support reactive notification actors

Use captured-event and check for the event type rather than using
enter-event and leave-event to allow actors added by Notification.addActor to be reactive.
Comment 3 Florian Müllner 2010-02-26 14:45:19 UTC
Review of attachment 154695 [details] [review]:

You should do something about your line wrapping. Seriously, try to review:

if (e
    t
else 
    t

Splinter is no fun anymore if you have to switch constantly between code and review ...

The patch obviously works, but then so did the previous version - I don't see how this is an improvement (if I'm not completely wrong you are doing just the same but with more code).

Note that I didn't try any of the proposals underneath, so they might be completely and utterly wrong. Nevertheless I think that restricting the event handling to events caused by the actor being entered from/left to the outside does make sense.

::: js/ui/messageTray.js
@@ +388,3 @@
+                                                                    do {
+                                                                    let source = event.get_source();
+        this.actor.connect('captured-event', Lang.bind(this, function(actor, event) {

Hit me if I'm wrong - but will source just never become null? You only capture events for this.actor, so I don't see how it could be triggered by any actor which is not a child of this.actor.

@@ +395,3 @@
+                                                                    do {
+                                                                    let source = event.get_source();
+        this.actor.connect('captured-event', Lang.bind(this, function(actor, event) {

If you move the pointer from the actor onto the child (or from the child onto the actor) you still call both this._onTrayLeft() and this._onTrayEntered().

If you want to avoid that you can check that event.get_source() == this.actor and event.get_related() is not a child of this.actor. Note that event.get_related() is only valid for crossing events (enter + leave), so you should check the event type before calling that (just check for other event types and return false).

When doing so it might be better to bite the bullet and use a separate function.
Comment 4 Dan Winship 2010-03-24 14:17:19 UTC
the code has changed in master to use StWidget:track-hover. does that fix the problem this bug was fixing?
Comment 5 drago01 2010-03-24 17:06:56 UTC
(In reply to comment #4)
> the code has changed in master to use StWidget:track-hover. does that fix the
> problem this bug was fixing?

Yes.