[gnome-shell] boxpointer: Prevent spurious input events while animating



commit 36804a60c90803aa47e05b00e7c506e3f361c378
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Jan 18 02:31:03 2012 +0000

    boxpointer: Prevent spurious input events while animating
    
    The hide animation causes hover notifications for the actors inside the
    boxpointer. PopupBaseMenuItems, in particular, grab the keyboard focus on
    hover notifications to enable keyboard navigation on menus. This, in turn,
    breaks modal dialogs' keyboard navigation since key focus is taken away from a
    just created dialog when the menu is hiding.
    
    Since input events aren't useful while menus are animating we just prevent
    them from propagating.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=662493

 js/ui/boxpointer.js |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index 8f93b0d..0535651 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -45,6 +45,21 @@ const BoxPointer = new Lang.Class({
         this._xPosition = 0;
         this._yPosition = 0;
         this._sourceAlignment = 0.5;
+        this._capturedEventId = 0;
+        this._muteInput();
+    },
+
+    _muteInput: function() {
+        if (this._capturedEventId == 0)
+            this._capturedEventId = this.actor.connect('captured-event',
+                                                       function() { return true; });
+    },
+
+    _unmuteInput: function() {
+        if (this._capturedEventId != 0) {
+            this.actor.disconnect(this._capturedEventId);
+            this._capturedEventId = 0;
+        }
     },
 
     show: function(animate, onComplete) {
@@ -75,7 +90,11 @@ const BoxPointer = new Lang.Class({
                                  xOffset: 0,
                                  yOffset: 0,
                                  transition: 'linear',
-                                 onComplete: onComplete,
+                                 onComplete: Lang.bind(this, function() {
+                                     this._unmuteInput();
+                                     if (onComplete)
+                                         onComplete();
+                                 }),
                                  time: POPUP_ANIMATION_TIME });
     },
 
@@ -102,6 +121,8 @@ const BoxPointer = new Lang.Class({
             }
         }
 
+        this._muteInput();
+
         Tweener.addTween(this, { opacity: 0,
                                  xOffset: xOffset,
                                  yOffset: yOffset,



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