From 36804a60c90803aa47e05b00e7c506e3f361c378 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Wed, 18 Jan 2012 02:31:03 +0000 Subject: [PATCH] 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 file changed, 22 insertions(+), 1 deletion(-) diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js index 8f93b0d8a..05356516c 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,