From b42af9aa991eba53fba9e4afbbbf09860a22d057 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 10 Dec 2012 03:55:14 -0500 Subject: [PATCH] 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 --- js/ui/grabHelper.js | 13 +++++++------ js/ui/popupMenu.js | 8 ++++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js index 6e1c54c34..9c8df702d 100644 --- a/js/ui/grabHelper.js +++ b/js/ui/grabHelper.js @@ -280,7 +280,8 @@ const GrabHelper = new Lang.Class({ // If the actor that was popped from the grab stack was not the actor // That was passed in, this call is ignored. 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); if (grabStackIndex < 0) @@ -298,7 +299,7 @@ const GrabHelper = new Lang.Class({ let poppedGrab = poppedGrabs[i]; if (poppedGrab.onUngrab) - poppedGrab.onUngrab(); + poppedGrab.onUngrab(params.isUser); if (poppedGrab.modal) this._releaseModalGrab(); @@ -329,7 +330,7 @@ const GrabHelper = new Lang.Class({ if (type == Clutter.EventType.KEY_PRESS && event.get_key_symbol() == Clutter.KEY_Escape) { - this.ungrab(); + this.ungrab({ isUser: true }); return true; } @@ -345,7 +346,7 @@ const GrabHelper = new Lang.Class({ if (press) this._ignoreRelease = true; 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; @@ -354,12 +355,12 @@ const GrabHelper = new Lang.Class({ _onKeyFocusChanged: function() { let focus = global.stage.key_focus; if (!focus || !this._isWithinGrabbedActor(focus)) - this.ungrab(); + this.ungrab({ isUser: true }); }, _focusWindowChanged: function() { let metaDisplay = global.screen.get_display(); if (metaDisplay.focus_window != null) - this.ungrab(); + this.ungrab({ isUser: true }); } }); diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index 202ae3d35..ba17b270d 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -2173,7 +2173,11 @@ const PopupMenuManager = new Lang.Class({ return -1; }, - _closeMenu: function(menu) { - menu.close(BoxPointer.PopupAnimation.FULL); + _closeMenu: function(isUser, menu) { + // 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); } });