[gnome-shell] workspace: Animate window clones using translation properties



commit 8929c89d1fbbdd7b150b3d46b485b2db732cfb00
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Thu Jan 16 18:42:50 2020 +0800

    workspace: Animate window clones using translation properties
    
    Instead of position x/y properties. This reduces CPU-intensive relayouts
    in JavaScript (`vfunc_allocate` etc).
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1271
    since the other fix required already landed in 4c4846e9.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/936

 js/ui/workspace.js | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index d470f7f402..3cfce9845d 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -155,8 +155,7 @@ var WindowClone = GObject.registerClass({
 
         this._updateAttachedDialogs();
         this._computeBoundingBox();
-        this.x = this._boundingBox.x;
-        this.y = this._boundingBox.y;
+        this.set_translation(this._boundingBox.x, this._boundingBox.y, 0);
 
         this._computeWindowCenter();
 
@@ -1364,8 +1363,8 @@ class Workspace extends St.Widget {
             if (!clone.positioned) {
                 // This window appeared after the overview was already up
                 // Grow the clone from the center of the slot
-                clone.x = x + cloneWidth / 2;
-                clone.y = y + cloneHeight / 2;
+                clone.translation_x = x + cloneWidth / 2;
+                clone.translation_y = y + cloneHeight / 2;
                 clone.scale_x = 0;
                 clone.scale_y = 0;
                 clone.positioned = true;
@@ -1380,8 +1379,8 @@ class Workspace extends St.Widget {
                         clone.opacity = 0;
                         clone.scale_x = 0;
                         clone.scale_y = 0;
-                        clone.x = x;
-                        clone.y = y;
+                        clone.translation_x = x;
+                        clone.translation_y = y;
                     }
 
                     clone.ease({
@@ -1395,7 +1394,7 @@ class Workspace extends St.Widget {
             } else {
                 // cancel any active tweens (otherwise they might override our changes)
                 clone.remove_all_transitions();
-                clone.set_position(x, y);
+                clone.set_translation(x, y, 0);
                 clone.set_scale(scale, scale);
                 clone.set_opacity(255);
                 clone.overlay.relayout(false);
@@ -1425,7 +1424,8 @@ class Workspace extends St.Widget {
 
     _animateClone(clone, overlay, x, y, scale) {
         clone.ease({
-            x, y,
+            translation_x: x,
+            translation_y: y,
             scale_x: scale,
             scale_y: scale,
             duration: Overview.ANIMATION_TIME,
@@ -1570,7 +1570,7 @@ class Workspace extends St.Widget {
             clone.slot = [x, y, clone.width * scale, clone.height * scale];
             clone.positioned = true;
 
-            clone.set_position(x, y);
+            clone.set_translation(x, y, 0);
             clone.set_scale(scale, scale);
             clone.overlay.relayout(false);
         }
@@ -1725,8 +1725,8 @@ class Workspace extends St.Widget {
             let [origX, origY] = clone.getOriginalPosition();
             clone.scale_x = 1;
             clone.scale_y = 1;
-            clone.x = origX;
-            clone.y = origY;
+            clone.translation_x = origX;
+            clone.translation_y = origY;
             clone.ease({
                 opacity,
                 duration,
@@ -1776,8 +1776,8 @@ class Workspace extends St.Widget {
         if (clone.metaWindow.showing_on_its_workspace()) {
             let [origX, origY] = clone.getOriginalPosition();
             clone.ease({
-                x: origX,
-                y: origY,
+                translation_x: origX,
+                translation_y: origY,
                 scale_x: 1,
                 scale_y: 1,
                 opacity: 255,


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