[gnome-shell/gnome-40] altTab: Check for reentrancy in override function of _onItemMotion()



commit 560f01eb599dd3f051691ee9504c9772a44ac6ec
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Wed Apr 25 21:34:00 2018 +0200

    altTab: Check for reentrancy in override function of _onItemMotion()
    
    Just like in the parent _onItemMotion() function, we should check for
    reentrancy in our override.
    
    Because the hover timeout will prevent a new selection from happening
    for some time, in addition to checking for this._highlighted reentrancy,
    we also need to track the item that's being hovered during the timeout.
    
    (cherry picked from commit 7f65fa49db1dcc8df91627bf30df58427056d3af)
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2181>

 js/ui/altTab.js | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/altTab.js b/js/ui/altTab.js
index c03c680c33..e7886e4f1e 100644
--- a/js/ui/altTab.js
+++ b/js/ui/altTab.js
@@ -707,6 +707,7 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
         }
 
         this._altTabPopup = altTabPopup;
+        this._delayedHighlighted = -1;
         this._mouseTimeOutId = 0;
 
         this.connect('destroy', this._onDestroy.bind(this));
@@ -792,16 +793,26 @@ class AppSwitcher extends SwitcherPopup.SwitcherList {
     // We override SwitcherList's _onItemMotion method to delay
     // activation when the thumbnail list is open
     _onItemMotion(item) {
+        if (item === this._items[this._highlighted] ||
+            item === this._items[this._delayedHighlighted])
+            return Clutter.EVENT_PROPAGATE;
+
         const index = this._items.indexOf(item);
 
-        if (this._mouseTimeOutId != 0)
+        if (this._mouseTimeOutId !== 0) {
             GLib.source_remove(this._mouseTimeOutId);
+            this._delayedHighlighted = -1;
+            this._mouseTimeOutId = 0;
+        }
+
         if (this._altTabPopup.thumbnailsVisible) {
+            this._delayedHighlighted = index;
             this._mouseTimeOutId = GLib.timeout_add(
                 GLib.PRIORITY_DEFAULT,
                 APP_ICON_HOVER_TIMEOUT,
                 () => {
                     this._enterItem(index);
+                    this._delayedHighlighted = -1;
                     this._mouseTimeOutId = 0;
                     return GLib.SOURCE_REMOVE;
                 });


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