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 666170 - Improve timing of tooltips (like in gtk+)
Improve timing of tooltips (like in gtk+)
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
3.3.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-12-14 12:50 UTC by Volker Sobek (weld)
Modified: 2012-01-20 19:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch visibility timeout for labels to behave more like gtk+ (2.40 KB, patch)
2011-12-22 12:02 UTC, Seif Lotfy
none Details | Review
Patch visibility timeout for labels to behave more like gtk+ (2.42 KB, patch)
2011-12-22 12:12 UTC, Seif Lotfy
none Details | Review
Patch visibility timeout for labels to behave more like gtk+ (2.63 KB, patch)
2011-12-22 20:30 UTC, Seif Lotfy
needs-work Details | Review
Patch visibility timeout for labels to behave more like gtk+ (2.89 KB, patch)
2012-01-17 23:30 UTC, Seif Lotfy
none Details | Review
Patch visibility timeout for labels to behave more like gtk+ (2.99 KB, patch)
2012-01-18 14:19 UTC, Seif Lotfy
needs-work Details | Review
Added a Dashboard for new tabs and zeitgeist powered searching (2.99 KB, patch)
2012-01-20 15:30 UTC, Seif Lotfy
none Details | Review
Patch to place tooltips beside buttons (for the dash) (2.98 KB, patch)
2012-01-20 15:31 UTC, Seif Lotfy
reviewed Details | Review
Patch visibility timeout for labels to behave more like gtk+ (2.81 KB, patch)
2012-01-20 18:55 UTC, Seif Lotfy
reviewed Details | Review
Patch visibility timeout for labels to behave more like gtk+ (2.74 KB, patch)
2012-01-20 19:10 UTC, Seif Lotfy
committed Details | Review

Description Volker Sobek (weld) 2011-12-14 12:50:35 UTC
I noticed that the recent gtk+ tooltips have an initial delay before showing up, but once the first tooltip for a button in a toolbar is visible (meaning the user is very likely exploring things) and you move the pointer along the toolbar, the tooltip will follow immediately.

It would be nice if the tooltips for apps in the dash would behave like that, too: the first tooltip would take some time to appear, but after that, moving the pointer over the apps in the dash would make the tooltip follow instantly.

As far as i can tell the unity launcher tooltips behave like that too.

Alternatively, the timeout for the dash tooltips could be made smaller.
Comment 1 Allan Day 2011-12-14 13:34:58 UTC
This is a good idea. I'd prefer the initial time out to be lower than what we have now. It's frustrating waiting for the label to appear.
Comment 2 Florian Müllner 2011-12-14 13:49:19 UTC
(Comment #1 already qualifies as ui-review, removing keyword)
Comment 3 Milan Bouchet-Valat 2011-12-14 15:00:18 UTC
(In reply to comment #2)
> (Comment #1 already qualifies as ui-review, removing keyword)
OK, I thought the tag was more used as a way to find bugs involving designers, even when they already commented on the issue.
Comment 4 Seif Lotfy 2011-12-18 14:25:11 UTC
In bug 6661066 we are implementing the alternative solution.
Comment 5 Seif Lotfy 2011-12-18 14:25:36 UTC
In bug 666166 we are implementing the alternative solution.
Comment 6 Allan Day 2011-12-18 17:15:21 UTC
(In reply to comment #5)
> In bug 666166 we are implementing the alternative solution.

I'd like to see both solutions in combination - faster initial appearance of the label and instant display of other labels thereafter.
Comment 7 Seif Lotfy 2011-12-22 12:02:55 UTC
Created attachment 204081 [details] [review]
Patch visibility timeout for labels to behave more like gtk+

I finished up a tiny fix...
Allan is this the behavior you seek?
Comment 8 Seif Lotfy 2011-12-22 12:12:50 UTC
Created attachment 204082 [details] [review]
Patch visibility timeout for labels to behave more like gtk+

Quick fix
Comment 9 Seif Lotfy 2011-12-22 20:30:06 UTC
Created attachment 204111 [details] [review]
Patch visibility timeout for labels to behave more like gtk+

Updated patch --> Please review
Comment 10 Allan Day 2012-01-05 10:19:08 UTC
(In reply to comment #9)
> Created an attachment (id=204111) [details] [review]
> Patch visibility timeout for labels to behave more like gtk+
> 
> Updated patch --> Please review

The design looks good. Would it be possible to use a very quick fade for showing and hiding the label once they are being displayed? Mixing fade transitions with non-fading feels awkward.
Comment 11 Florian Müllner 2012-01-10 23:33:51 UTC
Review of attachment 204111 [details] [review]:

Works as advertised, but there are a couple of style nits / clarity issues.

Regarding the commit message, we agreed to not call the dash labels "tooltips", and it is unclear what "toolbar" refers to.

::: js/ui/dash.js
@@ +302,3 @@
+        this._hideLabelTimeoutId = 0;
+        this._hoverTimeout = DASH_ITEM_HOVER_TIMEOUT;
+        this._isShowingLabel = false;

Sounds a bit odd to me - something like _labelIsShowing or _labelShowing reads more natural imho (with a preference for the latter, as capital i + l can be hard to distinguish)

@@ +459,3 @@
                         return false;
                     }));
+                Mainloop.source_remove(this._hideLabelTimeoutId);

You should
 (1) check that _hideLabelTimeoutId is valid
 (2) reset _hideLabelTimeoutId after calling source_remove

@@ +465,3 @@
+                Mainloop.source_remove(this._showLabelTimeoutId);
+            if (this._isShowingLabel) {
+                this._hoverTimeout = 0;

Any reason for not updating _hoverTimeout in the "showLabelTimeout" function?

@@ +466,3 @@
+            if (this._isShowingLabel) {
+                this._hoverTimeout = 0;
+                this._hideLabelTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,

Either _hideLabelTimeoutId is a misnomer (as the function sets two variables without hiding anything), or the call to hideLabel() should be moved into the anonymous function (probably nicer for symmetry with the if{} part)

@@ +469,3 @@
+                    Lang.bind(this, function() {
+                        this._hoverTimeout = DASH_ITEM_HOVER_TIMEOUT;
+                        this._isShowingLabel = false;

Missing return value.

@@ +472,3 @@
+                    }));
+            }
+            this._showLabelTimeoutId = 0;

The line above really belongs to the Mainloop.source_remove() call above.
Comment 12 Seif Lotfy 2012-01-17 23:29:17 UTC
Review of attachment 204111 [details] [review]:

::: js/ui/dash.js
@@ +465,3 @@
+                Mainloop.source_remove(this._showLabelTimeoutId);
+            if (this._isShowingLabel) {
+                this._hoverTimeout = 0;

which showLabelTimeout function?

@@ +466,3 @@
+            if (this._isShowingLabel) {
+                this._hoverTimeout = 0;
+                this._hideLabelTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,

I don't get the problem sorry? how should it look like then?
Comment 13 Seif Lotfy 2012-01-17 23:30:32 UTC
Created attachment 205494 [details] [review]
Patch visibility timeout for labels to behave more like gtk+

Went through most of Florians fixes
Comment 14 Florian Müllner 2012-01-18 07:22:19 UTC
(In reply to comment #12)
> which showLabelTimeout function?

The anonymous function passed as timeout source whose source id is _showLabelTimeoutId.


> @@ +466,3 @@
> +            if (this._isShowingLabel) {
> +                this._hoverTimeout = 0;
> +                this._hideLabelTimeoutId =
> Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT,
> 
> I don't get the problem sorry? how should it look like then?

You have

  showLabelTimeoutId = function() { /* stuff */ item.show(); }

but

  hideLabelTimeoutId = function() { /* stuff */ }; item.hide();

The name 'hideLabelTimeoutId' suggests that the label is hidden in the anonymous function, just like it's shown in the 'showLabelTimeoutId' function. So it should either do that to match the expectation or use another name.
Comment 15 Seif Lotfy 2012-01-18 14:19:49 UTC
Created attachment 205527 [details] [review]
Patch visibility timeout for labels to behave more like gtk+

Updated patch according to Florains suggestions
Comment 16 Florian Müllner 2012-01-19 15:08:01 UTC
Review of attachment 205527 [details] [review]:

See comments below, plus the commit message still uses "tooltip" and "toolbar"(???).

::: js/ui/dash.js
@@ +453,3 @@
         if (display.actor.get_hover() && !display.isMenuUp) {
+            if (this._showLabelTimeoutId == 0) {
+                this._showLabelTimeoutId = Mainloop.timeout_add(this._hoverTimeout,

No biggie, but you could get rid of this._hoverTimeout by using
  this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT
here.

@@ +463,3 @@
+                    Mainloop.source_remove(this._hideLabelTimeoutId);
+                    this._hideLabelTimeoutId = 0;
+                    item.hideLabel();

Why are you hiding the label here? I'd just expect something like

  if (this._hideLabelTimeoutId > 0)
      Mainloop.source_remove(this._hideLabelTimeoutId);
  this._hideLabelTimeoutId = 0;

@@ +470,3 @@
+                Mainloop.source_remove(this._showLabelTimeoutId);
+                this._showLabelTimeoutId = 0;
+                item.hideLabel();

... and another instance of hideLabel(); apparently this one is necessary, so you should not touch the original code (with the exception of renaming labelTimeoutId => showLabelTimeoutId)

@@ +477,3 @@
+                        this._hoverTimeout = DASH_ITEM_HOVER_TIMEOUT;
+                        this._labelShowing = false;
+                        item.hideLabel();

OK, so when I said that the timeout ID should match the functionality in the anonymous function, I didn't mean to add calls to hideLabel() all over the place - we should only call it once, and as we already need to hide it above, the call here is redundant. In that case, _hideLabelTimeoutId is misleading, so I'd suggest _resetHoverTimeoutId instead (I'm also not entirely sold on reusing DASH_ITEM_HOVER_TIMEOUT here for "the time between hiding the label and considering it hidden", but I can live with it)
Comment 17 Seif Lotfy 2012-01-20 15:30:03 UTC
Created attachment 205702 [details] [review]
Added a Dashboard for new tabs and zeitgeist powered searching
Comment 18 Seif Lotfy 2012-01-20 15:31:42 UTC
Created attachment 205703 [details] [review]
Patch to place tooltips beside buttons (for the dash)
Comment 19 Florian Müllner 2012-01-20 18:07:00 UTC
Review of attachment 205703 [details] [review]:

Mostly good; apart from the comments below, you shouldn't indent the commit message

::: js/ui/dash.js
@@ +301,3 @@
+        this._showLabelTimeoutId = 0;
+        this._resetHoverTimeoutId = 0;
+        this._hoverTimeout = DASH_ITEM_HOVER_TIMEOUT;

Never read => remove

@@ +454,3 @@
+            if (this._showLabelTimeoutId == 0) {
+                this._showLabelTimeoutId = Mainloop.timeout_add(
+                    this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT,

"Weird" indentation style; if you want to avoid an overly long line (which I appreciate btw, but we don't have a hard limit), you can use a local variable:

let timeout = this._labelShowing ? 0 : HOVER_TIMEOUT;
this._showLableTimeoutId = Mainloop.timeout_add(timeout,
    ...

@@ +470,3 @@
+                Mainloop.source_remove(this._showLabelTimeoutId);
+                this._showLabelTimeoutId = 0;
+                item.hideLabel();

Please move that out of the block as mentioned in the last review:

if (id > 0)
  Mainloop.source_remove(id);
id = 0;
item.hideLabel();
Comment 20 Seif Lotfy 2012-01-20 18:55:09 UTC
Created attachment 205722 [details] [review]
Patch visibility timeout for labels to behave more like gtk+
Comment 21 Florian Müllner 2012-01-20 19:01:16 UTC
Review of attachment 205722 [details] [review]:

Almost ...

::: js/ui/dash.js
@@ +466,3 @@
         } else {
+            if (this._showLabelTimeoutId > 0) {
+                    Mainloop.source_remove(this._showLabelTimeoutId);

You changed the indent, but not the scope (note the brackets); OK with this fix.
Comment 22 Seif Lotfy 2012-01-20 19:10:01 UTC
Created attachment 205724 [details] [review]
Patch visibility timeout for labels to behave more like gtk+
Comment 23 Florian Müllner 2012-01-20 19:11:30 UTC
Review of attachment 205724 [details] [review]:

Go for it!
Comment 24 Seif Lotfy 2012-01-20 19:14:30 UTC
I dont have my git gnome stuff set up here... Can you push it?
Comment 25 Florian Müllner 2012-01-20 19:21:43 UTC
(In reply to comment #24)
> I dont have my git gnome stuff set up here... Can you push it?

Sure.