[gnome-shell/wip/overviewAnimationsBakcup: 1/3] workspace: Fade in instead of zoom to return desktop



commit 7b2c6c6ca3d9dba5f837c9ed6b00bb6d88befcec
Author: Carlos Soriano <carlos soriano89 gmail com>
Date:   Tue Jul 8 14:16:39 2014 +0200

    workspace: Fade in instead of zoom to return desktop
    
    The zooming animation of the windows looks nice when animating
    from the workspace display page, but looks weird from others pages
    like apps page or search page since the windows comes from nowhere
    with a initial position not known for the user.
    
    Instead of that just fade the desktop with the windows in its
    original position.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732901

 js/ui/overview.js       |    2 +-
 js/ui/viewSelector.js   |   12 ++++++++++--
 js/ui/workspace.js      |   16 ++++++++++++++--
 js/ui/workspacesView.js |   22 +++++++++++-----------
 4 files changed, 36 insertions(+), 16 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 5bf114d..634adaf 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -625,7 +625,7 @@ const Overview = new Lang.Class({
         this.animationInProgress = true;
         this.visibleTarget = false;
 
-        this.viewSelector.zoomFromOverview();
+        this.viewSelector.animateFromOverview();
 
         // Make other elements fade out.
         Tweener.addTween(this._stack,
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index b743fa7..db4cbb1 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -19,6 +19,7 @@ const Search = imports.ui.search;
 const ShellEntry = imports.ui.shellEntry;
 const Tweener = imports.ui.tweener;
 const WorkspacesView = imports.ui.workspacesView;
+const Workspace = imports.ui.workspace;
 
 const SHELL_KEYBINDINGS_SCHEMA = 'org.gnome.shell.keybindings';
 
@@ -318,8 +319,15 @@ const ViewSelector = new Lang.Class({
             Main.overview.fadeOutDesktop();
     },
 
-    zoomFromOverview: function() {
-        this._workspacesDisplay.zoomFromOverview();
+    animateFromOverview: function() {
+        let animationType = this._activePage == this._workspacesPage ? Workspace.AnimationType.ZOOM :
+                                                                       Workspace.AnimationType.FADE_IN;
+        if (animationType == Workspace.AnimationType.FADE_IN) {
+            this._workspacesPage.show();
+            this._workspacesPage.opacity = 255;
+            this._showPage(this._workspacesPage);
+        }
+        this._workspacesDisplay.animateFromOverview(animationType);
 
         if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
             Main.overview.fadeInDesktop();
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index ec012c0..29fc940 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -34,6 +34,11 @@ const DRAGGING_WINDOW_OPACITY = 100;
 const LAYOUT_SCALE_WEIGHT = 1;
 const LAYOUT_SPACE_WEIGHT = 0.1;
 
+const AnimationType = {
+    ZOOM: 0,
+    FADE_IN: 1
+};
+
 function _interpolate(start, end, step) {
     return start + (end - start) * step;
 }
@@ -1563,13 +1568,13 @@ const Workspace = new Lang.Class({
     },
 
     // Animate the full-screen to Overview transition.
-    zoomToOverview : function() {
+    animateToOverview : function() {
         // Position and scale the windows.
         this._recalculateWindowPositions(WindowPositionFlags.ANIMATE | WindowPositionFlags.INITIAL);
     },
 
     // Animates the return from Overview mode
-    zoomFromOverview : function() {
+    animateFromOverview : function(animationType) {
         let currentWorkspace = global.screen.get_active_workspace();
 
         this.leavingOverview = true;
@@ -1600,6 +1605,13 @@ const Workspace = new Lang.Class({
             if (clone.metaWindow.showing_on_its_workspace()) {
                 let [origX, origY] = clone.getOriginalPosition();
 
+                if (animationType == AnimationType.FADE_IN) {
+                    clone.actor.scale_x = 1;
+                    clone.actor.scale_y = 1;
+                    clone.actor.x = origX;
+                    clone.actor.y = origY;
+                    clone.actor.opacity = 0;
+                }
                 Tweener.addTween(clone.actor,
                                  { x: origX,
                                    y: origY,
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 61df6ab..98dc2e6 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -142,17 +142,17 @@ const WorkspacesView = new Lang.Class({
         return this._workspaces[active];
     },
 
-    zoomToOverview: function() {
+    animateToOverview: function() {
         for (let w = 0; w < this._workspaces.length; w++)
-            this._workspaces[w].zoomToOverview();
+            this._workspaces[w].animateToOverview();
         this._updateWorkspaceActors(false);
     },
 
-    zoomFromOverview: function() {
+    animateFromOverview: function(animationType) {
         this.actor.remove_clip();
 
         for (let w = 0; w < this._workspaces.length; w++)
-            this._workspaces[w].zoomFromOverview();
+            this._workspaces[w].animateFromOverview(animationType);
     },
 
     syncStacking: function(stackIndices) {
@@ -365,12 +365,12 @@ const ExtraWorkspaceView = new Lang.Class({
         this._workspace.setActualGeometry(this._actualGeometry);
     },
 
-    zoomToOverview: function() {
-        this._workspace.zoomToOverview();
+    animateToOverview: function() {
+        this._workspace.animateToOverview();
     },
 
-    zoomFromOverview: function() {
-        this._workspace.zoomFromOverview();
+    animateFromOverview: function(animationType) {
+        this._workspace.animateFromOverview(animationType);
     },
 
     syncStacking: function(stackIndices) {
@@ -465,7 +465,7 @@ const WorkspacesDisplay = new Lang.Class({
     show: function() {
         this._updateWorkspacesViews();
         for (let i = 0; i < this._workspacesViews.length; i++)
-            this._workspacesViews[i].zoomToOverview();
+            this._workspacesViews[i].animateToOverview();
 
         this._restackedNotifyId =
             Main.overview.connect('windows-restacked',
@@ -474,9 +474,9 @@ const WorkspacesDisplay = new Lang.Class({
             this._scrollEventId = Main.overview.connect('scroll-event', Lang.bind(this, 
this._onScrollEvent));
     },
 
-    zoomFromOverview: function() {
+    animateFromOverview: function(animationType) {
         for (let i = 0; i < this._workspacesViews.length; i++)
-            this._workspacesViews[i].zoomFromOverview();
+            this._workspacesViews[i].animateFromOverview(animationType);
     },
 
     hide: function() {


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