Blame SOURCES/0001-desktopManager-Hook-into-LayoutManager-to-create-gri.patch

9062cd
From 62289dff5cb2e615a277b72f034fa42f45aad639 Mon Sep 17 00:00:00 2001
9062cd
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
9062cd
Date: Thu, 15 Dec 2022 15:14:08 +0100
9062cd
Subject: [PATCH] desktopManager: Hook into LayoutManager to create grids
9062cd
9062cd
Right now we track the `monitors-changed` signal to recreate the
9062cd
per-monitor grids. Usually that's enough, but if something else
9062cd
causes backgrounds to update, we'll end up without desktop icons
9062cd
until some other change (settings, mounts, monitor/resolution
9062cd
changes, ...) results in a reload of the grid.
9062cd
9062cd
To address this, hook into LayoutManager to always create the grid
9062cd
when backgrounds are updated.
9062cd
---
9062cd
 extensions/desktop-icons/desktopManager.js | 15 +++++++++++----
9062cd
 1 file changed, 11 insertions(+), 4 deletions(-)
9062cd
9062cd
diff --git a/extensions/desktop-icons/desktopManager.js b/extensions/desktop-icons/desktopManager.js
9062cd
index 08bc82b7..74d0e6bd 100644
9062cd
--- a/extensions/desktop-icons/desktopManager.js
9062cd
+++ b/extensions/desktop-icons/desktopManager.js
9062cd
@@ -83,7 +83,6 @@ var DesktopManager = GObject.registerClass({
9062cd
         this._discreteGpuAvailable = false;
9062cd
         this._rubberBandActive = false;
9062cd
 
9062cd
-        this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', () => this._recreateDesktopIcons());
9062cd
         this._rubberBand = new St.Widget({ style_class: 'rubber-band' });
9062cd
         this._rubberBand.hide();
9062cd
         Main.layoutManager._backgroundGroup.add_child(this._rubberBand);
9062cd
@@ -109,6 +108,13 @@ var DesktopManager = GObject.registerClass({
9062cd
             return origCapturedEvent.bind(this._grabHelper)(event);
9062cd
         };
9062cd
 
9062cd
+        this._origUpdateBackgrounds =
9062cd
+            Main.layoutManager._updateBackgrounds;
9062cd
+        Main.layoutManager._updateBackgrounds = () => {
9062cd
+            this._origUpdateBackgrounds.call(Main.layoutManager);
9062cd
+            this._recreateDesktopIcons();
9062cd
+        };
9062cd
+
9062cd
         this._addDesktopIcons();
9062cd
         this._monitorDesktopFolder();
9062cd
 
9062cd
@@ -843,9 +849,10 @@ var DesktopManager = GObject.registerClass({
9062cd
             GLib.source_remove(this._deleteChildrenId);
9062cd
         this._deleteChildrenId = 0;
9062cd
 
9062cd
-        if (this._monitorsChangedId)
9062cd
-            Main.layoutManager.disconnect(this._monitorsChangedId);
9062cd
-        this._monitorsChangedId = 0;
9062cd
+        if (this._origUpdateBackgrounds)
9062cd
+            Main.layoutManager._updateBackgrounds = this._origUpdateBackgrounds;
9062cd
+        delete this._origUpdateBackgrounds;
9062cd
+
9062cd
         if (this._stageReleaseEventId)
9062cd
             global.stage.disconnect(this._stageReleaseEventId);
9062cd
         this._stageReleaseEventId = 0;
9062cd
-- 
9062cd
2.38.1
9062cd