[gnome-shell] workspace: Handle window-added and removed signal after window tracker



commit 454394a267ba94492c14c2e1de720e5fc78483bd
Author: Sebastian Keller <skeller gnome org>
Date:   Tue Feb 2 22:31:32 2021 +0100

    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>

 js/ui/workspace.js | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index ff4d4c70bf..951f452193 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -982,17 +982,17 @@ class Workspace extends St.Widget {
                 this._addWindowClone(windows[i]);
         }
 
-        // Track window changes
+        // Track window changes, but let the window tracker process them first
         if (this.metaWorkspace) {
-            this._windowAddedId = this.metaWorkspace.connect('window-added',
-                                                             this._windowAdded.bind(this));
-            this._windowRemovedId = this.metaWorkspace.connect('window-removed',
-                                                               this._windowRemoved.bind(this));
+            this._windowAddedId = this.metaWorkspace.connect_after(
+                'window-added', this._windowAdded.bind(this));
+            this._windowRemovedId = this.metaWorkspace.connect_after(
+                'window-removed', this._windowRemoved.bind(this));
         }
-        this._windowEnteredMonitorId = global.display.connect('window-entered-monitor',
-                                                              this._windowEnteredMonitor.bind(this));
-        this._windowLeftMonitorId = global.display.connect('window-left-monitor',
-                                                           this._windowLeftMonitor.bind(this));
+        this._windowEnteredMonitorId = global.display.connect_after(
+            'window-entered-monitor', this._windowEnteredMonitor.bind(this));
+        this._windowLeftMonitorId = global.display.connect_after(
+            'window-left-monitor', this._windowLeftMonitor.bind(this));
         this._layoutFrozenId = 0;
 
         // DND requires this to be set


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