From 584016c2910acfb171ac5ab61b622156f4ab3f86 Mon Sep 17 00:00:00 2001 From: Sergio Costas Date: Sat, 3 Oct 2020 13:12:24 +0000 Subject: [PATCH 01/15] window-list: Honor changes in skip-taskbar property Although window-list checks the 'skip-taskbar' property when a window is added to the desktop to decide wether it should be shown in the bar or not, it doesn't honor that when the property is changed after a window has already been added. Since the new WaylandClient API allows to change this property for already mapped windows, supporting this is a good idea. This patch fixes this. Fix https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/130 (cherry picked from commit b65f362f0d65b54a155eda78da773b0369d23669) --- extensions/window-list/extension.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 523ffb2f..3c45d002 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -352,6 +352,9 @@ class WindowButton extends BaseButton { super._init(perMonitor, monitorIndex); this.metaWindow = metaWindow; + this._skipTaskbarId = metaWindow.connect('notify::skip-taskbar', () => { + this._updateVisibility(); + }); this._updateVisibility(); this._windowTitle = new WindowTitle(this.metaWindow); @@ -412,6 +415,7 @@ class WindowButton extends BaseButton { _onDestroy() { super._onDestroy(); + this.metaWindow.disconnect(this._skipTaskbarId); this.metaWindow.disconnect(this._workspaceChangedId); global.display.disconnect(this._notifyFocusId); this._contextMenu.destroy(); @@ -948,9 +952,6 @@ class WindowList extends St.Widget { } _onWindowAdded(ws, win) { - if (win.skip_taskbar) - return; - if (!this._grouped) this._checkGrouping(); From 1276a880de78d6e4bce8814b7d2d987b7deab347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 Oct 2020 02:34:41 +0200 Subject: [PATCH 02/15] workspace-indicator: Use custom layout manager for thumbnails The current code positions window previews explicitly using a fixed layout manager. For that it relies on a valid parent allocation, which is error-prone and frequently results in warnings. Address this by moving the positioning code into a custom layout manager, and only update the visibility from the window preview. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/260 --- extensions/workspace-indicator/extension.js | 67 +++++++++++---------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 6d13acf5..12634e25 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -30,27 +30,15 @@ class WindowPreview extends St.Button { this.connect('destroy', this._onDestroy.bind(this)); this._sizeChangedId = this._window.connect('size-changed', - this._relayout.bind(this)); + () => this.queue_relayout()); this._positionChangedId = this._window.connect('position-changed', - this._relayout.bind(this)); + () => this.queue_relayout()); this._minimizedChangedId = this._window.connect('notify::minimized', - this._relayout.bind(this)); + this._updateVisible.bind(this)); this._monitorEnteredId = global.display.connect('window-entered-monitor', - this._relayout.bind(this)); + this._updateVisible.bind(this)); this._monitorLeftId = global.display.connect('window-left-monitor', - this._relayout.bind(this)); - - // Do initial layout when we get a parent - let id = this.connect('parent-set', () => { - this.disconnect(id); - if (!this.get_parent()) - return; - this._laterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { - this._laterId = 0; - this._relayout(); - return false; - }); - }); + this._updateVisible.bind(this)); this._focusChangedId = global.display.connect('notify::focus-window', this._onFocusChanged.bind(this)); @@ -69,8 +57,6 @@ class WindowPreview extends St.Button { global.display.disconnect(this._monitorEnteredId); global.display.disconnect(this._monitorLeftId); global.display.disconnect(this._focusChangedId); - if (this._laterId) - Meta.later_remove(this._laterId); } _onFocusChanged() { @@ -80,26 +66,41 @@ class WindowPreview extends St.Button { this.remove_style_class_name('active'); } - _relayout() { + _updateVisible() { let monitor = Main.layoutManager.findIndexForActor(this); this.visible = monitor === this._window.get_monitor() && this._window.window_type !== Meta.WindowType.DESKTOP && this._window.showing_on_its_workspace(); + } +}); - if (!this.visible) - return; +let WorkspaceLayout = GObject.registerClass( +class WorkspaceLayout extends Clutter.LayoutManager { + vfunc_get_preferred_width() { + return [0, 0]; + } - let workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); - let hscale = this.get_parent().allocation.get_width() / workArea.width; - let vscale = this.get_parent().allocation.get_height() / workArea.height; + vfunc_get_preferred_height() { + return [0, 0]; + } - let frameRect = this._window.get_frame_rect(); - this.set_size( - Math.round(Math.min(frameRect.width, workArea.width) * hscale), - Math.round(Math.min(frameRect.height, workArea.height) * vscale)); - this.set_position( - Math.round(frameRect.x * hscale), - Math.round(frameRect.y * vscale)); + vfunc_allocate(container, box) { + const monitor = Main.layoutManager.findIndexForActor(container); + const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); + const hscale = box.get_width() / workArea.width; + const vscale = box.get_height() / workArea.height; + + for (const child of container) { + const childBox = new Clutter.ActorBox(); + const frameRect = child.metaWindow.get_frame_rect(); + childBox.set_size( + Math.min(frameRect.width, workArea.width) * hscale, + Math.min(frameRect.height, workArea.height) * vscale); + childBox.set_origin( + Math.round(frameRect.x * hscale), + Math.round(frameRect.y * vscale)); + child.allocate(childBox); + } } }); @@ -109,7 +110,7 @@ class WorkspaceThumbnail extends St.Button { super._init({ style_class: 'workspace', child: new Clutter.Actor({ - layout_manager: new Clutter.BinLayout(), + layout_manager: new WorkspaceLayout(), clip_to_allocation: true, }), }); From ed81650f55290e124cc010845f7bdaec3cc627e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 Oct 2020 02:48:43 +0200 Subject: [PATCH 03/15] window-list: Use custom layout manager for thumbnails The current code positions window previews explicitly using a fixed layout manager. For that it relies on a valid parent allocation, which is error-prone and frequently results in warnings. Address this by moving the positioning code into a custom layout manager, and only update the visibility from the window preview. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/260 --- extensions/window-list/workspaceIndicator.js | 67 ++++++++++---------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js index ca3dc615..af0e4f78 100644 --- a/extensions/window-list/workspaceIndicator.js +++ b/extensions/window-list/workspaceIndicator.js @@ -24,27 +24,15 @@ class WindowPreview extends St.Button { this.connect('destroy', this._onDestroy.bind(this)); this._sizeChangedId = this._window.connect('size-changed', - this._relayout.bind(this)); + () => this.queue_relayout()); this._positionChangedId = this._window.connect('position-changed', - this._relayout.bind(this)); + () => this.queue_relayout()); this._minimizedChangedId = this._window.connect('notify::minimized', - this._relayout.bind(this)); + this._updateVisible.bind(this)); this._monitorEnteredId = global.display.connect('window-entered-monitor', - this._relayout.bind(this)); + this._updateVisible.bind(this)); this._monitorLeftId = global.display.connect('window-left-monitor', - this._relayout.bind(this)); - - // Do initial layout when we get a parent - let id = this.connect('parent-set', () => { - this.disconnect(id); - if (!this.get_parent()) - return; - this._laterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => { - this._laterId = 0; - this._relayout(); - return false; - }); - }); + this._updateVisible.bind(this)); this._focusChangedId = global.display.connect('notify::focus-window', this._onFocusChanged.bind(this)); @@ -63,8 +51,6 @@ class WindowPreview extends St.Button { global.display.disconnect(this._monitorEnteredId); global.display.disconnect(this._monitorLeftId); global.display.disconnect(this._focusChangedId); - if (this._laterId) - Meta.later_remove(this._laterId); } _onFocusChanged() { @@ -74,26 +60,41 @@ class WindowPreview extends St.Button { this.remove_style_class_name('active'); } - _relayout() { + _updateVisible() { let monitor = Main.layoutManager.findIndexForActor(this); this.visible = monitor === this._window.get_monitor() && this._window.window_type !== Meta.WindowType.DESKTOP && this._window.showing_on_its_workspace(); + } +}); - if (!this.visible) - return; +let WorkspaceLayout = GObject.registerClass( +class WorkspaceLayout extends Clutter.LayoutManager { + vfunc_get_preferred_width() { + return [0, 0]; + } - let workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); - let hscale = this.get_parent().allocation.get_width() / workArea.width; - let vscale = this.get_parent().allocation.get_height() / workArea.height; + vfunc_get_preferred_height() { + return [0, 0]; + } - let frameRect = this._window.get_frame_rect(); - this.set_size( - Math.round(Math.min(frameRect.width, workArea.width) * hscale), - Math.round(Math.min(frameRect.height, workArea.height) * vscale)); - this.set_position( - Math.round(frameRect.x * hscale), - Math.round(frameRect.y * vscale)); + vfunc_allocate(container, box) { + const monitor = Main.layoutManager.findIndexForActor(container); + const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); + const hscale = box.get_width() / workArea.width; + const vscale = box.get_height() / workArea.height; + + for (const child of container) { + const childBox = new Clutter.ActorBox(); + const frameRect = child.metaWindow.get_frame_rect(); + childBox.set_size( + Math.round(Math.min(frameRect.width, workArea.width) * hscale), + Math.round(Math.min(frameRect.height, workArea.height) * vscale)); + childBox.set_origin( + Math.round(frameRect.x * hscale), + Math.round(frameRect.y * vscale)); + child.allocate(childBox); + } } }); @@ -103,7 +104,7 @@ class WorkspaceThumbnail extends St.Button { super._init({ style_class: 'workspace', child: new Clutter.Actor({ - layout_manager: new Clutter.BinLayout(), + layout_manager: new WorkspaceLayout(), clip_to_allocation: true, }), }); From 435879c12176f855d95f22a3ef30b72234f9d6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 Oct 2020 00:11:06 +0200 Subject: [PATCH 04/15] workspace-indicator: Adjust to overview changes Window DND in the overview is now based on the metaWindow, not the window actor (misnamed as "real window"). https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/133 --- extensions/workspace-indicator/extension.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 12634e25..21080c10 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -46,8 +46,8 @@ class WindowPreview extends St.Button { } // needed for DND - get realWindow() { - return this._window.get_compositor_private(); + get metaWindow() { + return this._window; } _onDestroy() { @@ -141,16 +141,15 @@ class WorkspaceThumbnail extends St.Button { } acceptDrop(source) { - if (!source.realWindow) + if (!source.metaWindow) return false; - let window = source.realWindow.get_meta_window(); - this._moveWindow(window); + this._moveWindow(source.metaWindow); return true; } handleDragOver(source) { - if (source.realWindow) + if (source.metaWindow) return DND.DragMotionResult.MOVE_DROP; else return DND.DragMotionResult.CONTINUE; From e734fcbd2130a189f3743ce75af3703261c18c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 Oct 2020 02:42:55 +0200 Subject: [PATCH 05/15] window-list: Adjust to overview changes Window DND in the overview is now based on the metaWindow, not the window actor (misnamed as "real window"). https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/133 --- extensions/window-list/workspaceIndicator.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js index af0e4f78..698cc9df 100644 --- a/extensions/window-list/workspaceIndicator.js +++ b/extensions/window-list/workspaceIndicator.js @@ -40,8 +40,8 @@ class WindowPreview extends St.Button { } // needed for DND - get realWindow() { - return this._window.get_compositor_private(); + get metaWindow() { + return this._window; } _onDestroy() { @@ -135,16 +135,15 @@ class WorkspaceThumbnail extends St.Button { } acceptDrop(source) { - if (!source.realWindow) + if (!source.metaWindow) return false; - let window = source.realWindow.get_meta_window(); - this._moveWindow(window); + this._moveWindow(source.metaWindow); return true; } handleDragOver(source) { - if (source.realWindow) + if (source.metaWindow) return DND.DragMotionResult.MOVE_DROP; else return DND.DragMotionResult.CONTINUE; From 3b22582752adede2d451f57d7e467184490f44e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 5 Nov 2020 22:09:30 +0100 Subject: [PATCH 06/15] auto-move-windows: Exclude sticky windows from empty-check We modify gnome-shell's workspace tracker to only remove empty workspaces from the end. However we currently don't take into account that sticky windows appear on all workspaces, so those are preventing any workspace from getting removed at the moment. Exclude them when determining whether a workspace is empty to get the expected behavior. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/135 (cherry picked from commit 61cf679b8c6c86b62bff1d9e2489320b8a04fa4d) --- extensions/auto-move-windows/extension.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extensions/auto-move-windows/extension.js b/extensions/auto-move-windows/extension.js index d99244c0..b9bc3a00 100644 --- a/extensions/auto-move-windows/extension.js +++ b/extensions/auto-move-windows/extension.js @@ -116,10 +116,12 @@ function myCheckWorkspaces() { let keepAliveWorkspaces = []; let foundNonEmpty = false; for (let i = this._workspaces.length - 1; i >= 0; i--) { - if (!foundNonEmpty) - foundNonEmpty = this._workspaces[i].list_windows().length > 0; - else if (!this._workspaces[i]._keepAliveId) + if (!foundNonEmpty) { + foundNonEmpty = this._workspaces[i].list_windows().some( + w => !w.is_on_all_workspaces()); + } else if (!this._workspaces[i]._keepAliveId) { keepAliveWorkspaces.push(this._workspaces[i]); + } } // make sure the original method only removes empty workspaces at the end From 5ad272e62822f746a822a80932d34bc70b8b8e84 Mon Sep 17 00:00:00 2001 From: Thun Pin Date: Wed, 18 Nov 2020 23:54:18 +0000 Subject: [PATCH 07/15] window-navigator: Adjust to 3.38 overview changes gnome-shell's overview code changed significantly in 3.38, adjust the extension to work without the separate overlay. https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/259 (cherry picked from commit 737c897624e9929a3b4e91fffc0b539447f2494e) --- extensions/windowsNavigator/extension.js | 134 +++++++++++------------ 1 file changed, 65 insertions(+), 69 deletions(-) diff --git a/extensions/windowsNavigator/extension.js b/extensions/windowsNavigator/extension.js index 088cd3f5..e4513d80 100644 --- a/extensions/windowsNavigator/extension.js +++ b/extensions/windowsNavigator/extension.js @@ -1,45 +1,12 @@ /* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */ /* exported init */ -const { Clutter, GObject, St } = imports.gi; +const { Clutter, Graphene, GObject, St } = imports.gi; const Main = imports.ui.main; const Workspace = imports.ui.workspace; const WorkspacesView = imports.ui.workspacesView; -class MyWindowOverlay extends Workspace.WindowOverlay { - constructor(windowClone, parentActor) { - super(windowClone, parentActor); - - this._id = null; - this._text = new St.Label({ - style_class: 'extension-windowsNavigator-window-tooltip', - visible: false, - }); - parentActor.add_actor(this._text); - } - - showTooltip() { - this._parentActor.set_child_below_sibling(this._text, null); - this._text.show(); - this._text.text = (this._windowClone.slotId + 1).toString(); - } - - hideTooltip() { - if (this._text && this._text.visible) - this._text.hide(); - } - - relayout(animate) { - super.relayout(animate); - - let [cloneX, cloneY, cloneWidth_, cloneHeight_] = this._windowClone.slot; - - let textX = cloneX - 2; - let textY = cloneY - 2; - this._text.set_position(Math.floor(textX) + 5, Math.floor(textY) + 5); - this._parentActor.set_child_below_sibling(this._text, null); - } -} +const WINDOW_SLOT = 4; var MyWorkspace = GObject.registerClass( class MyWorkspace extends Workspace.Workspace { @@ -61,57 +28,89 @@ class MyWorkspace extends Workspace.Workspace { } } + vfunc_allocate(box) { + super.vfunc_allocate(box); + + if (this._tip) + this._tip.allocate_preferred_size(0, 0); + } + showTooltip() { - if (!this._tip || !this._actualGeometry) + if (!this._tip) return; this._tip.text = (this.metaWorkspace.index() + 1).toString(); - - // Hand code this instead of using _getSpacingAndPadding - // because that fails on empty workspaces - let node = this.get_theme_node(); - let padding = { - left: node.get_padding(St.Side.LEFT), - top: node.get_padding(St.Side.TOP), - bottom: node.get_padding(St.Side.BOTTOM), - right: node.get_padding(St.Side.RIGHT), - }; - - let area = Workspace.padArea(this._actualGeometry, padding); - this._tip.x = area.x; - this._tip.y = area.y; this._tip.show(); this.set_child_below_sibling(this._tip, null); } hideTooltip() { - if (!this._tip) - return; - if (!this._tip.get_parent()) - return; - this._tip.hide(); + if (this._tip) + this._tip.hide(); } getWindowWithTooltip(id) { - for (let i = 0; i < this._windows.length; i++) { - if (this._windows[i].slotId + 1 === id) - return this._windows[i].metaWindow; - } - return null; + const slot = this.layout_manager._windowSlots[id - 1]; + return slot ? slot[WINDOW_SLOT].metaWindow : null; } showWindowsTooltips() { - for (let i in this._windowOverlays) { - if (this._windowOverlays[i]) - this._windowOverlays[i].showTooltip(); + for (let i = 0; i < this.layout_manager._windowSlots.length; i++) { + if (this.layout_manager._windowSlots[i]) + this.layout_manager._windowSlots[i][WINDOW_SLOT].showTooltip(`${i + 1}`); } } hideWindowsTooltips() { - for (let i in this._windowOverlays) { - if (this._windowOverlays[i]) - this._windowOverlays[i].hideTooltip(); + for (let i in this.layout_manager._windowSlots) { + if (this.layout_manager._windowSlots[i]) + this.layout_manager._windowSlots[i][WINDOW_SLOT].hideTooltip(); } } + + // overriding _addWindowClone to apply the tooltip patch on the cloned + // windowPreview + _addWindowClone(metaWindow) { + const clone = super._addWindowClone(metaWindow); + + // appling the tooltip patch + (function patchPreview() { + this._text = new St.Label({ + style_class: 'extension-windowsNavigator-window-tooltip', + visible: false, + }); + + this._text.add_constraint(new Clutter.BindConstraint({ + source: this._borderCenter, + coordinate: Clutter.BindCoordinate.POSITION, + })); + this._text.add_constraint(new Clutter.AlignConstraint({ + source: this._borderCenter, + align_axis: Clutter.AlignAxis.X_AXIS, + pivot_point: new Graphene.Point({ x: 0.5, y: -1 }), + factor: this._closeButtonSide === St.Side.LEFT ? 1 : 0, + })); + this._text.add_constraint(new Clutter.AlignConstraint({ + source: this._borderCenter, + align_axis: Clutter.AlignAxis.Y_AXIS, + pivot_point: new Graphene.Point({ x: -1, y: 0.5 }), + factor: 0, + })); + + this.add_child(this._text); + }).call(clone); + + clone.showTooltip = function (text) { + this._text.set({ text }); + this._text.show(); + }; + + clone.hideTooltip = function () { + if (this._text && this._text.visible) + this._text.hide(); + }; + + return clone; + } }); var MyWorkspacesView = GObject.registerClass( @@ -244,19 +243,16 @@ class MyWorkspacesView extends WorkspacesView.WorkspacesView { class Extension { constructor() { - this._origWindowOverlay = Workspace.WindowOverlay; this._origWorkspace = Workspace.Workspace; this._origWorkspacesView = WorkspacesView.WorkspacesView; } enable() { - Workspace.WindowOverlay = MyWindowOverlay; Workspace.Workspace = MyWorkspace; WorkspacesView.WorkspacesView = MyWorkspacesView; } disable() { - Workspace.WindowOverlay = this._origWindowOverlay; Workspace.Workspace = this._origWorkspace; WorkspacesView.WorkspacesView = this._origWorkspacesView; } From de8876bd5ed35d82b9d38bc403ac1682d8954675 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 24 Nov 2020 00:24:55 -0500 Subject: [PATCH 08/15] window-list: Stop monitoring drag operation if window list is destroyed If a user is in the middle of a drag in the window list and the window list associated with the drag gets destroyed, the drag monitor gets leaked. Later when the drag motion is processed, spew goes to the log: clutter_actor_contains: assertion 'CLUTTER_IS_ACTOR (self)' failed Examples of triggers for this bug: - The monitor topology changes - The screen gets locked during the drag This commit fixes the spew and the leak by ensuring any pending drag monitoring is disabled when the window lists are destroyed. Part-of: (cherry picked from commit 8318ea919f2d01b12e5c14047fca02d4333be720) --- extensions/window-list/extension.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 3c45d002..8babbaeb 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -787,9 +787,9 @@ class WindowList extends St.Widget { }); this._dragBeginId = Main.xdndHandler.connect('drag-begin', - this._onDragBegin.bind(this)); + this._monitorDrag.bind(this)); this._dragEndId = Main.xdndHandler.connect('drag-end', - this._onDragEnd.bind(this)); + this._stopMonitoringDrag.bind(this)); this._dragMonitor = { dragMotion: this._onDragMotion.bind(this), }; @@ -1017,11 +1017,11 @@ class WindowList extends St.Widget { } } - _onDragBegin() { + _monitorDrag() { DND.addDragMonitor(this._dragMonitor); } - _onDragEnd() { + _stopMonitoringDrag() { DND.removeDragMonitor(this._dragMonitor); this._removeActivateTimeout(); } @@ -1095,6 +1095,7 @@ class WindowList extends St.Widget { global.display.disconnect(this._fullscreenChangedId); + this._stopMonitoringDrag(); Main.xdndHandler.disconnect(this._dragBeginId); Main.xdndHandler.disconnect(this._dragEndId); From b4a4ff0a06de4b7655b0e528b25cdfb4e75a6b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 2 Dec 2020 19:09:57 +0100 Subject: [PATCH 09/15] workspace-indicator: Round calculated preview sizes While not strictly necessary, there's no reason to differ from the copy in the window-list extension ... Part-of: (cherry picked from commit f5128e13f21f41d632cd9ec1de2f55a77e9a3dfe) --- extensions/workspace-indicator/extension.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 21080c10..6452eefb 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -94,8 +94,8 @@ class WorkspaceLayout extends Clutter.LayoutManager { const childBox = new Clutter.ActorBox(); const frameRect = child.metaWindow.get_frame_rect(); childBox.set_size( - Math.min(frameRect.width, workArea.width) * hscale, - Math.min(frameRect.height, workArea.height) * vscale); + Math.round(Math.min(frameRect.width, workArea.width) * hscale), + Math.round(Math.min(frameRect.height, workArea.height) * vscale)); childBox.set_origin( Math.round(frameRect.x * hscale), Math.round(frameRect.y * vscale)); From 37f03f5e2ec652eb48b14f6ec1b483fc40f9fe6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 Oct 2020 20:22:32 +0200 Subject: [PATCH 10/15] window-list: Account for monitor offset in window previews Windows' frame rects are in screen coordinates, while the workspace thumbnails are based on the monitor work area. Unless we account for the difference, previews end up mispositioned in multi-monitor setups. Part-of: (cherry picked from commit 893d3b0473f5ff24e25c2cdb21bfea968b134f6a) --- extensions/window-list/workspaceIndicator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/window-list/workspaceIndicator.js b/extensions/window-list/workspaceIndicator.js index 698cc9df..3dbfb0ca 100644 --- a/extensions/window-list/workspaceIndicator.js +++ b/extensions/window-list/workspaceIndicator.js @@ -91,8 +91,8 @@ class WorkspaceLayout extends Clutter.LayoutManager { Math.round(Math.min(frameRect.width, workArea.width) * hscale), Math.round(Math.min(frameRect.height, workArea.height) * vscale)); childBox.set_origin( - Math.round(frameRect.x * hscale), - Math.round(frameRect.y * vscale)); + Math.round((frameRect.x - workArea.x) * hscale), + Math.round((frameRect.y - workArea.y) * vscale)); child.allocate(childBox); } } From 991f6ef508caad15398c0171199edcbab5fc3042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 Oct 2020 20:24:18 +0200 Subject: [PATCH 11/15] workspace-indicator: Account for monitor offset in window previews Windows' frame rects are in screen coordinates, while the workspace thumbnails are based on the monitor work area. Unless we account for the difference, previews end up mispositioned in multi-monitor setups. Part-of: (cherry picked from commit 6949a5d075ef773cfae289976d8b5713aad26508) --- extensions/workspace-indicator/extension.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 6452eefb..d10e13e8 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -97,8 +97,8 @@ class WorkspaceLayout extends Clutter.LayoutManager { Math.round(Math.min(frameRect.width, workArea.width) * hscale), Math.round(Math.min(frameRect.height, workArea.height) * vscale)); childBox.set_origin( - Math.round(frameRect.x * hscale), - Math.round(frameRect.y * vscale)); + Math.round((frameRect.x - workArea.x) * hscale), + Math.round((frameRect.y - workArea.y) * vscale)); child.allocate(childBox); } } 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 12/15] 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(); } From d7a824f35fcdf078c0c8f4a20f5bcddd5abfae5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 Oct 2020 20:43:46 +0200 Subject: [PATCH 13/15] workspace-indicator: 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 50d3ee57037ccea173c2a48fa324eb8b0acc3730) --- extensions/workspace-indicator/extension.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index d10e13e8..76b35df9 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -32,13 +32,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)); @@ -54,8 +53,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); } @@ -67,8 +64,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(); } From 365fa6abc920d39b664dab470c7b1aad9ee978c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 3 Dec 2020 00:09:57 +0100 Subject: [PATCH 14/15] Update sass submodule --- data/gnome-shell-sass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/gnome-shell-sass b/data/gnome-shell-sass index 940aff8c..d82ed828 160000 --- a/data/gnome-shell-sass +++ b/data/gnome-shell-sass @@ -1 +1 @@ -Subproject commit 940aff8ce7e58c8717f9edd9e55539301bc23d68 +Subproject commit d82ed828715d964ed0aa59ccbfafcad1f1a230a9 From fb66afbf71bde243934bd3534cf7c459b13f341c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 3 Dec 2020 00:12:18 +0100 Subject: [PATCH 15/15] Bump version to 3.38.2 Update NEWS. --- NEWS | 13 +++++++++++++ meson.build | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 434dcd45..11fbe6d2 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ +3.38.2 +====== +* window-list: Honor changes in skip-taskbar property [Sergio; !130] +* window-list, workspace-indicator: Improve previews in workspace thumbs + [Florian; #260, !142] +* window-list, workspace-indicator: Adjust to 3.38 changes [Florian; !133] +* auto-move: Improve behavior on multi-monitor setups [Florian; !135] +* windowNavigator: Adjust to 3.38 changes [Thun; #259] +* Misc. bug fixes [Ray; !145] + +Contributors: + Sergio Costas, Florian Müllner, Thun Pin, Ray Strode + 3.38.1 ====== diff --git a/meson.build b/meson.build index f07b82ed..2e265324 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('gnome-shell-extensions', - version: '3.38.1', + version: '3.38.2', meson_version: '>= 0.44.0', license: 'GPL2+' )