[gnome-shell] dash: improve timing of labels



commit 6829590c8f4ca8332a150b53b57f68679f452c7e
Author: Seif Lotfy <seif lotfy collabora co uk>
Date:   Fri Jan 20 16:14:16 2012 +0100

    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 <seif lotfy collabora co uk>

 js/ui/dash.js |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index e2ff6ee..86b7e75 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;
+                    }));
+            }
         }
     },
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]