[gnome-shell] switcherPopup: Ignore implicit enter events when the popup is mapped



commit e94de67bd22626839fe4c4cb1bcc84e3b1dbe856
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Feb 28 13:35:57 2017 +0100

    switcherPopup: Ignore implicit enter events when the popup is mapped
    
    If the popup happens to be mapped beneath the pointer, mutter will now
    emit an implicit enter notify event (i.e. not caused by pointer motion).
    In this case the switcherPopup still goes and selects the item, which
    results in too sensitive alt-tab menus if the pointer happens to be in
    the wrong place.
    
    Make highlighting rely on motion events instead, so it always involves
    user interaction when triggered by the pointer.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755164

 js/ui/switcherPopup.js |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/switcherPopup.js b/js/ui/switcherPopup.js
index ae7bc77..4538ceb 100644
--- a/js/ui/switcherPopup.js
+++ b/js/ui/switcherPopup.js
@@ -385,7 +385,7 @@ const SwitcherList = new Lang.Class({
 
         let n = this._items.length;
         bbox.connect('clicked', Lang.bind(this, function() { this._onItemClicked(n); }));
-        bbox.connect('enter-event', Lang.bind(this, function() { this._onItemEnter(n); }));
+        bbox.connect('motion-event', Lang.bind(this, function() { return this._onItemEnter(n); }));
 
         bbox.label_actor = label;
 
@@ -399,7 +399,11 @@ const SwitcherList = new Lang.Class({
     },
 
     _onItemEnter: function (index) {
-        this._itemEntered(index);
+        // Avoid reentrancy
+        if (index != this._currentItemEntered) {
+            this._currentItemEntered = index;
+            this._itemEntered(index);
+        }
         return Clutter.EVENT_PROPAGATE;
     },
 


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