[gnome-shell] Cancel zoom of non-focused windows when leaving overview



commit a21ba292ebc9f7b16d2e71d9086e98bbaf909a30
Author: Florian Müllner <fmuellner src gnome org>
Date:   Mon Feb 15 23:11:09 2010 +0100

    Cancel zoom of non-focused windows when leaving overview
    
    When leaving the overview by hitting escape or super, all windows animate
    to their original positions. Zoomed windows are kept above others until
    the animation ends, then the focused window is brought to the front; as
    this looks odd if the zoomed window does not have focus, cancel the zoom
    in that case before leaving the overview.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=609243

 js/ui/workspace.js |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index cf75f05..20da931 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -130,6 +130,7 @@ WindowClone.prototype = {
         this._inDrag = false;
 
         this._zooming = false;
+        this._selected = false;
     },
 
     setStackAbove: function (actor) {
@@ -144,6 +145,20 @@ WindowClone.prototype = {
         this.actor.destroy();
     },
 
+    zoomFromOverview: function() {
+        if (this._zooming) {
+            // If the user clicked on the zoomed window, or we are
+            // returning there anyways, then we can zoom right to the
+            // window, but if we are going to some other window, then
+            // we need to cancel the zoom before animating, or it
+            // will look funny.
+
+            if (!this._selected &&
+                this.metaWindow != global.screen.get_display().focus_window)
+                this._zoomEnd();
+        }
+    },
+
     _onDestroy: function() {
         if (this._zoomLightbox)
             this._zoomLightbox.destroy();
@@ -256,6 +271,7 @@ WindowClone.prototype = {
     },
 
     _onButtonRelease : function (actor, event) {
+        this._selected = true;
         this.emit('selected', event.get_time());
     },
 
@@ -1225,12 +1241,14 @@ Workspace.prototype = {
         this._hideAllOverlays();
 
         Main.overview.connect('hidden', Lang.bind(this,
-                                                 this._doneLeavingOverview));
+                                                  this._doneLeavingOverview));
 
         // Position and scale the windows.
         for (let i = 1; i < this._windows.length; i++) {
             let clone = this._windows[i];
 
+            clone.zoomFromOverview();
+
             if (clone.metaWindow.showing_on_its_workspace()) {
                 Tweener.addTween(clone.actor,
                                  { x: clone.origX,



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