[gnome-shell/wip/jimmac/dash-icon-spacing: 34/72] overviewControls: Ease main adjustment when animating to/from overview




commit 004d1d530bd19fbcef266e413bba32a9da0948ec
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Jan 1 14:00:30 2021 -0300

    overviewControls: Ease main adjustment when animating to/from overview
    
    Instead of delegating it to ViewSelector, make the transition to and from
    overview ease the main state adjustment.
    
    This commit temporarily breaks these animations, but on the other hand
    introduces an important feature: ViewSelector is always allocated to the
    actual size. This will finally allow for adding WorkspacesView as a child
    of WorkspacesDisplay, and finally remove the actual geometry hack, which
    is what next commit is about.
    
    This commit also effectively reverts f955029dc.

 js/ui/overviewControls.js | 22 ++++++++++++++++++++++
 js/ui/viewSelector.js     |  2 --
 js/ui/workspacesView.js   | 20 --------------------
 3 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index 4f50b02744..b619a1a702 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -126,6 +126,8 @@ class ControlsManager extends St.Widget {
             clip_to_allocation: true,
         });
 
+        this._animating = false;
+
         this._searchEntry = new St.Entry({
             style_class: 'search-entry',
             /* Translators: this is the text displayed
@@ -188,6 +190,9 @@ class ControlsManager extends St.Widget {
     }
 
     _onShowAppsButtonToggled() {
+        if (this._animating)
+            return;
+
         const checked = this.dash.showAppsButton.checked;
 
         const value = checked
@@ -218,10 +223,27 @@ class ControlsManager extends St.Widget {
 
     animateToOverview() {
         this.viewSelector.animateToOverview();
+
+        this._adjustment.value = ControlsState.HIDDEN;
+        this._adjustment.ease(ControlsState.WINDOW_PICKER, {
+            duration: SIDE_CONTROLS_ANIMATION_TIME,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+        });
     }
 
     animateFromOverview() {
+        this._animating = true;
+
         this.viewSelector.animateFromOverview();
+
+        this._adjustment.ease(ControlsState.HIDDEN, {
+            duration: SIDE_CONTROLS_ANIMATION_TIME,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+            onStopped: () => {
+                this.dash.showAppsButton.checked = false;
+                this._animating = false;
+            },
+        });
     }
 
     get searchEntry() {
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index a5a896a407..2c03a26712 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -344,8 +344,6 @@ var ViewSelector = GObject.registerClass({
     animateFromOverview() {
         this._workspacesDisplay.animateFromOverview();
 
-        this._showAppsButton.checked = false;
-
         if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
             Main.overview.fadeInDesktop();
     }
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 2be70aedaa..9ac7e3d08a 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -537,7 +537,6 @@ class WorkspacesDisplay extends St.Widget {
 
         this._gestureActive = false; // touch(pad) gestures
         this._canScroll = true; // limiting scrolling speed
-        this._animating = false;
 
         this.connect('destroy', this._onDestroy.bind(this));
     }
@@ -734,28 +733,14 @@ class WorkspacesDisplay extends St.Widget {
     }
 
     animateFromOverview() {
-        this._animating = true;
-
         for (let i = 0; i < this._workspacesViews.length; i++)
             this._workspacesViews[i].animateFromOverview();
 
         this._leavingOverview = true;
         this._updateSwipeTracker();
-
-        const { primaryIndex } = Main.layoutManager;
-        const { x, y, width, height } =
-            Main.layoutManager.getWorkAreaForMonitor(primaryIndex);
-        this._getPrimaryView().ease({
-            x, y, width, height,
-            duration: ANIMATION_TIME,
-            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
-            onStopped: () => (this._animating = false),
-        });
     }
 
     vfunc_hide() {
-        this._animating = false;
-
         if (this._restackedNotifyId > 0) {
             Main.overview.disconnect(this._restackedNotifyId);
             this._restackedNotifyId = 0;
@@ -788,8 +773,6 @@ class WorkspacesDisplay extends St.Widget {
     }
 
     _updateWorkspacesViews() {
-        this._animating = false;
-
         for (let i = 0; i < this._workspacesViews.length; i++)
             this._workspacesViews[i].destroy();
 
@@ -866,9 +849,6 @@ class WorkspacesDisplay extends St.Widget {
 
         this._syncActualGeometryLater =
             Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
-                if (this._animating)
-                    return GLib.SOURCE_CONTINUE;
-
                 this._syncWorkspacesActualGeometry();
 
                 this._syncActualGeometryLater = 0;


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