workspace: Handle window-added and removed signal after window tracker

The new window preview overlay requires getting the app icon for a
window from the window tracker when it gets initialized. The window
tracker listens for the same 'window-added' signal on the MetaWorkspace
that the gnome-shell Workspace listens for to add the window preview.

The window tracker however reconnects all its signal handlers whenever
the number of workspaces changes, which means that its signal handlers
get called after the ones in Workspace ones. So by the time the
'window-added' handler in Workspace is called, the window tracker does
not have an app associated with the window.

To fix this ensure that all window related signal handlers in Workspace
are run after the ones in the window tracker.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3656

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1625>
This commit is contained in:
Sebastian Keller 2021-02-02 22:31:32 +01:00
parent 9ce666ac13
commit 454394a267

View File

@ -982,17 +982,17 @@ class Workspace extends St.Widget {
this._addWindowClone(windows[i]); this._addWindowClone(windows[i]);
} }
// Track window changes // Track window changes, but let the window tracker process them first
if (this.metaWorkspace) { if (this.metaWorkspace) {
this._windowAddedId = this.metaWorkspace.connect('window-added', this._windowAddedId = this.metaWorkspace.connect_after(
this._windowAdded.bind(this)); 'window-added', this._windowAdded.bind(this));
this._windowRemovedId = this.metaWorkspace.connect('window-removed', this._windowRemovedId = this.metaWorkspace.connect_after(
this._windowRemoved.bind(this)); 'window-removed', this._windowRemoved.bind(this));
} }
this._windowEnteredMonitorId = global.display.connect('window-entered-monitor', this._windowEnteredMonitorId = global.display.connect_after(
this._windowEnteredMonitor.bind(this)); 'window-entered-monitor', this._windowEnteredMonitor.bind(this));
this._windowLeftMonitorId = global.display.connect('window-left-monitor', this._windowLeftMonitorId = global.display.connect_after(
this._windowLeftMonitor.bind(this)); 'window-left-monitor', this._windowLeftMonitor.bind(this));
this._layoutFrozenId = 0; this._layoutFrozenId = 0;
// DND requires this to be set // DND requires this to be set