[gnome-shell/wip/jimmac/dash-icon-spacing: 13/72] workspacesView: Always use ZOOM transition




commit a97cb45bfb169f90f8b25a84062f61bb0f169b65
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Jun 28 14:42:44 2020 +0200

    workspacesView: Always use ZOOM transition
    
    Workspaces are now always shown, so the code path to fade windows
    instead of zooming out is dead now; remove it.

 js/ui/viewSelector.js   |   4 +-
 js/ui/workspace.js      | 128 ------------------------------------------------
 js/ui/workspacesView.js |  75 +++++++---------------------
 3 files changed, 21 insertions(+), 186 deletions(-)
---
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 57cf0481f6..0f33c4c521 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -340,7 +340,7 @@ var ViewSelector = GObject.registerClass({
     animateToOverview() {
         this.show();
         this.reset();
-        this._workspacesDisplay.animateToOverview(this._showAppsButton.checked);
+        this._workspacesDisplay.animateToOverview();
         this._activePage = null;
         this._showPage(this._appsPage);
 
@@ -349,7 +349,7 @@ var ViewSelector = GObject.registerClass({
     }
 
     animateFromOverview() {
-        this._workspacesDisplay.animateFromOverview(false);
+        this._workspacesDisplay.animateFromOverview();
 
         this._showAppsButton.checked = false;
 
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 581e2a80e7..af32962afc 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -21,8 +21,6 @@ var WINDOW_REPOSITIONING_DELAY = 750;
 var LAYOUT_SCALE_WEIGHT = 1;
 var LAYOUT_SPACE_WEIGHT = 0.1;
 
-var WINDOW_ANIMATION_MAX_NUMBER_BLENDING = 3;
-
 function _interpolate(start, end, step) {
     return start + (end - start) * step;
 }
@@ -1157,123 +1155,6 @@ class Workspace extends St.Widget {
         return false;
     }
 
-    fadeToOverview() {
-        // We don't want to reposition windows while animating in this way.
-        this.layout_manager.layout_frozen = true;
-        this._overviewShownId = Main.overview.connect('shown', this._doneShowingOverview.bind(this));
-        if (this._windows.length == 0)
-            return;
-
-        if (this.metaWorkspace !== null && !this.metaWorkspace.active)
-            return;
-
-        this.layout_manager.stateAdjustment.value = 0;
-
-        // Special case maximized windows, since it doesn't make sense
-        // to animate windows below in the stack
-        let topMaximizedWindow;
-        // It is ok to treat the case where there is no maximized
-        // window as if the bottom-most window was maximized given that
-        // it won't affect the result of the animation
-        for (topMaximizedWindow = this._windows.length - 1; topMaximizedWindow > 0; topMaximizedWindow--) {
-            let metaWindow = this._windows[topMaximizedWindow].metaWindow;
-            if (metaWindow.maximized_horizontally && metaWindow.maximized_vertically)
-                break;
-        }
-
-        let nTimeSlots = Math.min(WINDOW_ANIMATION_MAX_NUMBER_BLENDING + 1, this._windows.length - 
topMaximizedWindow);
-        let windowBaseTime = Overview.ANIMATION_TIME / nTimeSlots;
-
-        let topIndex = this._windows.length - 1;
-        for (let i = 0; i < this._windows.length; i++) {
-            if (i < topMaximizedWindow) {
-                // below top-most maximized window, don't animate
-                this._windows[i].hideOverlay(false);
-                this._windows[i].opacity = 0;
-            } else {
-                let fromTop = topIndex - i;
-                let time;
-                if (fromTop < nTimeSlots) // animate top-most windows gradually
-                    time = windowBaseTime * (nTimeSlots - fromTop);
-                else
-                    time = windowBaseTime;
-
-                this._windows[i].opacity = 255;
-                this._fadeWindow(i, time, 0);
-            }
-        }
-    }
-
-    fadeFromOverview() {
-        this.layout_manager.layout_frozen = true;
-        this._overviewHiddenId = Main.overview.connect('hidden', this._doneLeavingOverview.bind(this));
-        if (this._windows.length == 0)
-            return;
-
-        for (let i = 0; i < this._windows.length; i++)
-            this._windows[i].remove_all_transitions();
-
-        if (this._layoutFrozenId > 0) {
-            GLib.source_remove(this._layoutFrozenId);
-            this._layoutFrozenId = 0;
-        }
-
-        if (this.metaWorkspace !== null && !this.metaWorkspace.active)
-            return;
-
-        this.layout_manager.stateAdjustment.value = 0;
-
-        // Special case maximized windows, since it doesn't make sense
-        // to animate windows below in the stack
-        let topMaximizedWindow;
-        // It is ok to treat the case where there is no maximized
-        // window as if the bottom-most window was maximized given that
-        // it won't affect the result of the animation
-        for (topMaximizedWindow = this._windows.length - 1; topMaximizedWindow > 0; topMaximizedWindow--) {
-            let metaWindow = this._windows[topMaximizedWindow].metaWindow;
-            if (metaWindow.maximized_horizontally && metaWindow.maximized_vertically)
-                break;
-        }
-
-        let nTimeSlots = Math.min(WINDOW_ANIMATION_MAX_NUMBER_BLENDING + 1, this._windows.length - 
topMaximizedWindow);
-        let windowBaseTime = Overview.ANIMATION_TIME / nTimeSlots;
-
-        let topIndex = this._windows.length - 1;
-        for (let i = 0; i < this._windows.length; i++) {
-            if (i < topMaximizedWindow) {
-                // below top-most maximized window, don't animate
-                this._windows[i].hideOverlay(false);
-                this._windows[i].opacity = 0;
-            } else {
-                let fromTop = topIndex - i;
-                let time;
-                if (fromTop < nTimeSlots) // animate top-most windows gradually
-                    time = windowBaseTime * (fromTop + 1);
-                else
-                    time = windowBaseTime * nTimeSlots;
-
-                this._windows[i].opacity = 0;
-                this._fadeWindow(i, time, 255);
-            }
-        }
-    }
-
-    _fadeWindow(index, duration, opacity) {
-        let clone = this._windows[index];
-        clone.hideOverlay(false);
-
-        if (clone.metaWindow.showing_on_its_workspace()) {
-            clone.ease({
-                opacity,
-                duration,
-                mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-            });
-        } else {
-            // The window is hidden
-            clone.opacity = 0;
-        }
-    }
-
     zoomToOverview() {
         const animate =
             this.metaWorkspace === null || this.metaWorkspace.active;
@@ -1312,11 +1193,6 @@ class Workspace extends St.Widget {
             this._overviewHiddenId = 0;
         }
 
-        if (this._overviewShownId) {
-            Main.overview.disconnect(this._overviewShownId);
-            this._overviewShownId = 0;
-        }
-
         if (this.metaWorkspace) {
             this.metaWorkspace.disconnect(this._windowAddedId);
             this.metaWorkspace.disconnect(this._windowRemovedId);
@@ -1334,14 +1210,10 @@ class Workspace extends St.Widget {
 
     _doneLeavingOverview() {
         this.layout_manager.layout_frozen = false;
-        this.layout_manager.stateAdjustment.value = 0;
-        this._windows.forEach(w => (w.opacity = 255));
     }
 
     _doneShowingOverview() {
         this.layout_manager.layout_frozen = false;
-        this.layout_manager.stateAdjustment.value = 1;
-        this._windows.forEach(w => (w.opacity = 255));
     }
 
     _isMyWindow(window) {
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index b1d3011bf7..c658908d92 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -11,11 +11,6 @@ var { ANIMATION_TIME } = imports.ui.overview;
 var WORKSPACE_SWITCH_TIME = 250;
 var SCROLL_TIMEOUT_TIME = 150;
 
-var AnimationType = {
-    ZOOM: 0,
-    FADE: 1,
-};
-
 const MUTTER_SCHEMA = 'org.gnome.mutter';
 
 var WorkspacesViewBase = GObject.registerClass({
@@ -133,24 +128,16 @@ class WorkspacesView extends WorkspacesViewBase {
         return this._workspaces[active];
     }
 
-    animateToOverview(animationType) {
-        for (let w = 0; w < this._workspaces.length; w++) {
-            if (animationType == AnimationType.ZOOM)
-                this._workspaces[w].zoomToOverview();
-            else
-                this._workspaces[w].fadeToOverview();
-        }
+    animateToOverview() {
+        for (let w = 0; w < this._workspaces.length; w++)
+            this._workspaces[w].zoomToOverview();
         this._updateScrollPosition();
         this._updateVisibility();
     }
 
-    animateFromOverview(animationType) {
-        for (let w = 0; w < this._workspaces.length; w++) {
-            if (animationType == AnimationType.ZOOM)
-                this._workspaces[w].zoomFromOverview();
-            else
-                this._workspaces[w].fadeFromOverview();
-        }
+    animateFromOverview() {
+        for (let w = 0; w < this._workspaces.length; w++)
+            this._workspaces[w].zoomFromOverview();
     }
 
     syncStacking(stackIndices) {
@@ -320,18 +307,12 @@ class ExtraWorkspaceView extends WorkspacesViewBase {
         return this._workspace;
     }
 
-    animateToOverview(animationType) {
-        if (animationType == AnimationType.ZOOM)
-            this._workspace.zoomToOverview();
-        else
-            this._workspace.fadeToOverview();
+    animateToOverview() {
+        this._workspace.zoomToOverview();
     }
 
-    animateFromOverview(animationType) {
-        if (animationType == AnimationType.ZOOM)
-            this._workspace.zoomFromOverview();
-        else
-            this._workspace.fadeFromOverview();
+    animateFromOverview() {
+        this._workspace.zoomFromOverview();
     }
 
     syncStacking(stackIndices) {
@@ -397,7 +378,6 @@ class WorkspacesDisplay extends St.Widget {
             Main.overview.connect('window-drag-end',
                 this._windowDragEnd.bind(this));
         this._overviewShownId = Main.overview.connect('shown', () => {
-            this._inWindowFade = false;
             this._syncWorkspacesActualGeometry();
         });
 
@@ -419,7 +399,6 @@ class WorkspacesDisplay extends St.Widget {
 
         this._actualGeometry = null;
         this._inWindowDrag = false;
-        this._inWindowFade = false;
         this._leavingOverview = false;
 
         this._gestureActive = false; // touch(pad) gestures
@@ -580,22 +559,14 @@ class WorkspacesDisplay extends St.Widget {
             primaryWorkspace.visible = visible;
     }
 
-    animateToOverview(fadeOnPrimary) {
+    animateToOverview() {
         this.show();
         this._updateWorkspacesViews();
 
-        for (let i = 0; i < this._workspacesViews.length; i++) {
-            let animationType;
-            if (fadeOnPrimary && i == this._primaryIndex)
-                animationType = AnimationType.FADE;
-            else
-                animationType = AnimationType.ZOOM;
-            this._workspacesViews[i].animateToOverview(animationType);
-        }
-
-        this._inWindowFade = fadeOnPrimary;
+        for (let i = 0; i < this._workspacesViews.length; i++)
+            this._workspacesViews[i].animateToOverview();
 
-        if (this._actualGeometry && !fadeOnPrimary)
+        if (this._actualGeometry)
             this._syncWorkspacesActualGeometry();
 
         this._restackedNotifyId =
@@ -608,17 +579,9 @@ class WorkspacesDisplay extends St.Widget {
             this._keyPressEventId = global.stage.connect('key-press-event', 
this._onKeyPressEvent.bind(this));
     }
 
-    animateFromOverview(fadeOnPrimary) {
-        for (let i = 0; i < this._workspacesViews.length; i++) {
-            let animationType;
-            if (fadeOnPrimary && i == this._primaryIndex)
-                animationType = AnimationType.FADE;
-            else
-                animationType = AnimationType.ZOOM;
-            this._workspacesViews[i].animateFromOverview(animationType);
-        }
-
-        this._inWindowFade = fadeOnPrimary;
+    animateFromOverview() {
+        for (let i = 0; i < this._workspacesViews.length; i++)
+            this._workspacesViews[i].animateFromOverview();
 
         this._leavingOverview = true;
         this._updateSwipeTracker();
@@ -628,7 +591,7 @@ class WorkspacesDisplay extends St.Widget {
             Main.layoutManager.getWorkAreaForMonitor(primaryIndex);
         this._getPrimaryView().ease({
             x, y, width, height,
-            duration: fadeOnPrimary ? 0 : ANIMATION_TIME,
+            duration: ANIMATION_TIME,
             mode: Clutter.AnimationMode.EASE_OUT_QUAD,
         });
     }
@@ -751,7 +714,7 @@ class WorkspacesDisplay extends St.Widget {
 
     _syncWorkspacesActualGeometry() {
         const primaryView = this._getPrimaryView();
-        if (!primaryView || this._inWindowFade)
+        if (!primaryView)
             return;
 
         primaryView.ease({


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