[gnome-shell/gnome-3-36] padOsd: Cache label coordinates/arrangements



commit bd3f8de1e3acec0e76e3c2f22c46b0549ceaec68
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri May 29 16:07:28 2020 +0200

    padOsd: Cache label coordinates/arrangements
    
    This is actually static for a given PadDiagram, as it always represents
    a single device.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2570
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1290

 js/ui/padOsd.js | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/padOsd.js b/js/ui/padOsd.js
index 5576ab3601..a08b239283 100644
--- a/js/ui/padOsd.js
+++ b/js/ui/padOsd.js
@@ -444,14 +444,12 @@ var PadDiagram = GObject.registerClass({
         this._updateDiagramScale();
 
         for (let i = 0; i < this._labels.length; i++) {
-            const { label, action, idx, dir } = this._labels[i];
-            let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
+            const { label, x, y, arrangement } = this._labels[i];
             this._allocateChild(label, x, y, arrangement);
         }
 
         if (this._editorActor && this._curEdited) {
-            const { action, idx, dir } = this._curEdited;
-            let [found_, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
+            const { x, y, arrangement } = this._curEdited;
             this._allocateChild(this._editorActor, x, y, arrangement);
         }
     }
@@ -576,12 +574,12 @@ var PadDiagram = GObject.registerClass({
     }
 
     _addLabel(action, idx, dir) {
-        let [found] = this._getLabelCoords(action, idx, dir);
+        let [found, x, y, arrangement] = this._getLabelCoords(action, idx, dir);
         if (!found)
             return false;
 
         let label = new St.Label();
-        this._labels.push({ label, action, idx, dir });
+        this._labels.push({ label, action, idx, dir, x, y, arrangement });
         this.add_actor(label);
         return true;
     }


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