From 49b7973177d315cbf073a48de24df5b0ba3af5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 26 Feb 2021 13:36:26 +0100 Subject: [PATCH] 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: --- 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 933a0d5d4..457ae7554 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); } });