[gnome-shell] popupMenu: Don't slide menus when we're changing them



commit b42af9aa991eba53fba9e4afbbbf09860a22d057
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Dec 10 03:55:14 2012 -0500

    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 6e1c54c..9c8df70 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 202ae3d..ba17b27 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);
     }
 });



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