[gnome-shell/gbsneto/40-stuff: 21/68] workspacesView/workspacesDisplay: Don't sync geometry when animating




commit 23c396746251ce1a9599f2a66ca5a3895731652d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Dec 30 19:59:02 2020 -0300

    workspacesView/workspacesDisplay: Don't sync geometry when animating
    
    Synchronizing the actual geometry while animating from / to the overview can
    break the animation. Let's prevent that. This code will go away soon anyway,
    but it's better not to leave it misbehaving until then.

 js/ui/workspacesView.js | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 2a15ff7e2c..d82ad3bbbb 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -494,6 +494,7 @@ 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));
     }
@@ -687,6 +688,8 @@ class WorkspacesDisplay extends St.Widget {
     }
 
     animateFromOverview() {
+        this._animating = true;
+
         for (let i = 0; i < this._workspacesViews.length; i++)
             this._workspacesViews[i].animateFromOverview();
 
@@ -697,10 +700,13 @@ class WorkspacesDisplay extends St.Widget {
             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;
@@ -731,6 +737,8 @@ class WorkspacesDisplay extends St.Widget {
     }
 
     _updateWorkspacesViews() {
+        this._animating = false;
+
         for (let i = 0; i < this._workspacesViews.length; i++)
             this._workspacesViews[i].destroy();
 
@@ -807,6 +815,9 @@ 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]