[gnome-shell] workspaceThumbnail: Allocate final thumbnail sizes



commit 9980c806191fdf12725960dd5ba3fd8c6e0ace9b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Jan 25 20:59:46 2021 -0300

    workspaceThumbnail: Allocate final thumbnail sizes
    
    ThumbnailsBox currently allocates each workspace thumbnail using their
    porthole size, and scales them down using scale-x and scale-y. This is
    slightly problematic since it doesn't allow for properly styling these
    thumbnails through CSS.
    
    Rework ThumbnailsBox to allocate workspace thumbnails at their actual
    sizes, and scale down the '_contents' actor inside WorkspaceThumbnail.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1593>

 js/ui/workspaceThumbnail.js | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index a30cc0a73b..e238f2a1d4 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -318,8 +318,7 @@ var WorkspaceThumbnail = GObject.registerClass({
     }
 
     setPorthole(x, y, width, height) {
-        this.set_size(width, height);
-        this._contents.set_position(-x, -y);
+        this._contents.set_size(width, height);
     }
 
     _lookupIndex(metaWindow) {
@@ -611,6 +610,10 @@ var WorkspaceThumbnail = GObject.registerClass({
 
         return false;
     }
+
+    setScale(scale) {
+        this._contents.set_scale(scale, scale);
+    }
 });
 
 
@@ -727,10 +730,7 @@ var ThumbnailsBox = GObject.registerClass({
     _activateThumbnailAtPoint(stageX, stageY, time) {
         const [r_, x] = this.transform_stage_point(stageX, stageY);
 
-        const thumbnail = this._thumbnails.find(t => {
-            const [w] = t.get_transformed_size();
-            return x >= t.x && x <= t.x + w;
-        });
+        const thumbnail = this._thumbnails.find(t => x >= t.x && x <= t.x + t.width);
         if (thumbnail)
             thumbnail.activate(time);
     }
@@ -801,8 +801,7 @@ var ThumbnailsBox = GObject.registerClass({
         let targetX2;
 
         if (rtl) {
-            const [r_, w] = workspace.get_transformed_size();
-            const baseX = workspace.x + w;
+            const baseX = workspace.x + workspace.width;
             targetX1 = baseX - WORKSPACE_CUT_SIZE;
             targetX2 = baseX + spacing + WORKSPACE_CUT_SIZE;
         } else {
@@ -1358,15 +1357,15 @@ var ThumbnailsBox = GObject.registerClass({
             // of the actor, but x2/y2 are increased by the *unscaled* size.
             if (rtl) {
                 childBox.x2 = box.x2 - x1;
-                childBox.x1 = box.x2 - (x1 + portholeWidth);
+                childBox.x1 = box.x2 - (x1 + thumbnailWidth);
             } else {
                 childBox.x1 = x1;
-                childBox.x2 = x1 + portholeWidth;
+                childBox.x2 = x1 + thumbnailWidth;
             }
             childBox.y1 = y1;
-            childBox.y2 = y1 + portholeHeight;
+            childBox.y2 = y1 + thumbnailHeight;
 
-            thumbnail.set_scale(roundedHScale, roundedVScale);
+            thumbnail.setScale(roundedHScale, roundedVScale);
             thumbnail.allocate(childBox);
 
             if (i === indicatorUpperWs) {


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