From 0d8e412220be774669293d03b2b279273a5bb6ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 Oct 2020 20:40:56 +0200 Subject: [PATCH] window-list: Use overlap to determine preview visibility In order to better reflect the actual workspace, show any preview that is at least partially located on the monitor, not only those that have the major part on that monitor. Part-of: (cherry picked from commit 08dfb78815d30cc490440ea57a2724e608dbf0e4) --- extensions/window-list/workspaceIndicator.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js index 3dbfb0ca..37d1ff08 100644 --- a/extensions/window-list/workspaceIndicator.js +++ b/extensions/window-list/workspaceIndicator.js @@ -26,13 +26,12 @@ class WindowPreview extends St.Button { this._sizeChangedId = this._window.connect('size-changed', () => this.queue_relayout()); this._positionChangedId = this._window.connect('position-changed', - () => this.queue_relayout()); + () => { + this._updateVisible(); + this.queue_relayout(); + }); this._minimizedChangedId = this._window.connect('notify::minimized', this._updateVisible.bind(this)); - this._monitorEnteredId = global.display.connect('window-entered-monitor', - this._updateVisible.bind(this)); - this._monitorLeftId = global.display.connect('window-left-monitor', - this._updateVisible.bind(this)); this._focusChangedId = global.display.connect('notify::focus-window', this._onFocusChanged.bind(this)); @@ -48,8 +47,6 @@ class WindowPreview extends St.Button { this._window.disconnect(this._sizeChangedId); this._window.disconnect(this._positionChangedId); this._window.disconnect(this._minimizedChangedId); - global.display.disconnect(this._monitorEnteredId); - global.display.disconnect(this._monitorLeftId); global.display.disconnect(this._focusChangedId); } @@ -61,8 +58,9 @@ class WindowPreview extends St.Button { } _updateVisible() { - let monitor = Main.layoutManager.findIndexForActor(this); - this.visible = monitor === this._window.get_monitor() && + const monitor = Main.layoutManager.findIndexForActor(this); + const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); + this.visible = this._window.get_frame_rect().overlap(workArea) && this._window.window_type !== Meta.WindowType.DESKTOP && this._window.showing_on_its_workspace(); }