From 6829590c8f4ca8332a150b53b57f68679f452c7e Mon Sep 17 00:00:00 2001 From: Seif Lotfy Date: Fri, 20 Jan 2012 16:14:16 +0100 Subject: [PATCH] dash: improve timing of labels DashItem labels have initial delay before showing up, but once the first label in the dash is visible (meaning the user is very likely exploring things) and the pointer is moved along the dash, the label will follow immediately. https://bugzilla.gnome.org/show_bug.cgi?id=666170 Signed-off-by: Seif Lotfy --- js/ui/dash.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/js/ui/dash.js b/js/ui/dash.js index e2ff6ee9b..86b7e7553 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -298,7 +298,9 @@ const Dash = new Lang.Class({ this._dragPlaceholderPos = -1; this._animatingPlaceholdersCount = 0; this._favRemoveTarget = null; - this._labelTimeoutId = 0; + this._showLabelTimeoutId = 0; + this._resetHoverTimeoutId = 0; + this._labelShowing = false; this._box = new St.BoxLayout({ name: 'dash', vertical: true, @@ -448,18 +450,31 @@ const Dash = new Lang.Class({ _onHover: function (item, display) { if (display.actor.get_hover() && !display.isMenuUp) { - if (this._labelTimeoutId == 0) { - this._labelTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT, + if (this._showLabelTimeoutId == 0) { + let timeout = this._labelShowing ? 0 : DASH_ITEM_HOVER_TIMEOUT; + this._showLabelTimeoutId = Mainloop.timeout_add(timeout, Lang.bind(this, function() { + this._labelShowing = true; item.showLabel(); return false; })); + if (this._resetHoverTimeoutId > 0) { + Mainloop.source_remove(this._resetHoverTimeoutId); + this._resetHoverTimeoutId = 0; + } } } else { - if (this._labelTimeoutId > 0) - Mainloop.source_remove(this._labelTimeoutId); - this._labelTimeoutId = 0; + if (this._showLabelTimeoutId > 0) + Mainloop.source_remove(this._showLabelTimeoutId); + this._showLabelTimeoutId = 0; item.hideLabel(); + if (this._labelShowing) { + this._resetHoverTimeoutId = Mainloop.timeout_add(DASH_ITEM_HOVER_TIMEOUT, + Lang.bind(this, function() { + this._labelShowing = false; + return false; + })); + } } },