popupMenu: Don't slide menus when we're changing them

As calling close() will drop the grab, we were inadverdently
re-closing menus, causing them to re-animate with a full animation.

https://bugzilla.gnome.org/show_bug.cgi?id=689954
This commit is contained in:
Jasper St. Pierre 2012-12-10 03:55:14 -05:00
parent ca2ee22827
commit b42af9aa99
2 changed files with 13 additions and 8 deletions

View File

@ -280,7 +280,8 @@ const GrabHelper = new Lang.Class({
// If the actor that was popped from the grab stack was not the actor // If the actor that was popped from the grab stack was not the actor
// That was passed in, this call is ignored. // That was passed in, this call is ignored.
ungrab: function(params) { ungrab: function(params) {
params = Params.parse(params, { actor: this.currentGrab.actor }); params = Params.parse(params, { actor: this.currentGrab.actor,
isUser: false });
let grabStackIndex = this._findStackIndex(params.actor); let grabStackIndex = this._findStackIndex(params.actor);
if (grabStackIndex < 0) if (grabStackIndex < 0)
@ -298,7 +299,7 @@ const GrabHelper = new Lang.Class({
let poppedGrab = poppedGrabs[i]; let poppedGrab = poppedGrabs[i];
if (poppedGrab.onUngrab) if (poppedGrab.onUngrab)
poppedGrab.onUngrab(); poppedGrab.onUngrab(params.isUser);
if (poppedGrab.modal) if (poppedGrab.modal)
this._releaseModalGrab(); this._releaseModalGrab();
@ -329,7 +330,7 @@ const GrabHelper = new Lang.Class({
if (type == Clutter.EventType.KEY_PRESS && if (type == Clutter.EventType.KEY_PRESS &&
event.get_key_symbol() == Clutter.KEY_Escape) { event.get_key_symbol() == Clutter.KEY_Escape) {
this.ungrab(); this.ungrab({ isUser: true });
return true; return true;
} }
@ -345,7 +346,7 @@ const GrabHelper = new Lang.Class({
if (press) if (press)
this._ignoreRelease = true; this._ignoreRelease = true;
let i = this._actorInGrabStack(event.get_source()) + 1; let i = this._actorInGrabStack(event.get_source()) + 1;
this.ungrab({ actor: this._grabStack[i].actor }); this.ungrab({ actor: this._grabStack[i].actor, isUser: true });
} }
return this._modalCount > 0; return this._modalCount > 0;
@ -354,12 +355,12 @@ const GrabHelper = new Lang.Class({
_onKeyFocusChanged: function() { _onKeyFocusChanged: function() {
let focus = global.stage.key_focus; let focus = global.stage.key_focus;
if (!focus || !this._isWithinGrabbedActor(focus)) if (!focus || !this._isWithinGrabbedActor(focus))
this.ungrab(); this.ungrab({ isUser: true });
}, },
_focusWindowChanged: function() { _focusWindowChanged: function() {
let metaDisplay = global.screen.get_display(); let metaDisplay = global.screen.get_display();
if (metaDisplay.focus_window != null) if (metaDisplay.focus_window != null)
this.ungrab(); this.ungrab({ isUser: true });
} }
}); });

View File

@ -2173,7 +2173,11 @@ const PopupMenuManager = new Lang.Class({
return -1; return -1;
}, },
_closeMenu: function(menu) { _closeMenu: function(isUser, menu) {
menu.close(BoxPointer.PopupAnimation.FULL); // If this isn't a user action, we called close()
// on the BoxPointer ourselves, so we shouldn't
// reanimate.
if (isUser)
menu.close(BoxPointer.PopupAnimation.FULL);
} }
}); });