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
This commit is contained in:
Rui Matos 2012-01-18 02:31:03 +00:00
parent 73270345f5
commit 36804a60c9

View File

@ -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,