[gnome-shell] workspaceThumbnail: Consider porthole offsets



commit 49b7973177d315cbf073a48de24df5b0ba3af5be
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Feb 26 13:36:26 2021 +0100

    workspaceThumbnail: Consider porthole offsets
    
    Since commit 9980c806191f, the porthole position is ignored. As a result,
    previews are only shown if the primary monitor is located at (0, 0).
    
    To fix this, we either need to propagate the porthole to every thumbnail,
    use a custom layout manager that applies an offset to all children, or
    add an intermediate actor that offsets the contents.
    
    The last option is the simplest and doesn't require calls into JS on
    every allocation, so pick that one.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3781
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1721>

 js/ui/workspaceThumbnail.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 933a0d5d4a..457ae75545 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -271,8 +271,11 @@ var WorkspaceThumbnail = GObject.registerClass({
 
         this._removed = false;
 
+        this._viewport = new Clutter.Actor();
+        this.add_child(this._viewport);
+
         this._contents = new Clutter.Actor();
-        this.add_child(this._contents);
+        this._viewport.add_child(this._contents);
 
         this.connect('destroy', this._onDestroy.bind(this));
 
@@ -315,7 +318,8 @@ var WorkspaceThumbnail = GObject.registerClass({
     }
 
     setPorthole(x, y, width, height) {
-        this._contents.set_size(width, height);
+        this._viewport.set_size(width, height);
+        this._contents.set_position(-x, -y);
     }
 
     _lookupIndex(metaWindow) {
@@ -598,7 +602,7 @@ var WorkspaceThumbnail = GObject.registerClass({
     }
 
     setScale(scaleX, scaleY) {
-        this._contents.set_scale(scaleX, scaleY);
+        this._viewport.set_scale(scaleX, scaleY);
     }
 });
 


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