From bce0c1798c7b1918d056bbffcda319938b6b2581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 16 Dec 2022 17:57:40 +0100 Subject: [PATCH] Make desktop-icons resilient against background reloads Resolves: #2139895 --- ...ook-into-LayoutManager-to-create-gri.patch | 60 +++++++++++++++++++ ...Make-resilient-to-background-reloads.patch | 52 ++++++++++++++++ gnome-shell-extensions.spec | 3 + 3 files changed, 115 insertions(+) create mode 100644 0001-desktopManager-Hook-into-LayoutManager-to-create-gri.patch create mode 100644 desktop-icons-Make-resilient-to-background-reloads.patch diff --git a/0001-desktopManager-Hook-into-LayoutManager-to-create-gri.patch b/0001-desktopManager-Hook-into-LayoutManager-to-create-gri.patch new file mode 100644 index 0000000..5dd21d1 --- /dev/null +++ b/0001-desktopManager-Hook-into-LayoutManager-to-create-gri.patch @@ -0,0 +1,60 @@ +From 62289dff5cb2e615a277b72f034fa42f45aad639 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Thu, 15 Dec 2022 15:14:08 +0100 +Subject: [PATCH] desktopManager: Hook into LayoutManager to create grids + +Right now we track the `monitors-changed` signal to recreate the +per-monitor grids. Usually that's enough, but if something else +causes backgrounds to update, we'll end up without desktop icons +until some other change (settings, mounts, monitor/resolution +changes, ...) results in a reload of the grid. + +To address this, hook into LayoutManager to always create the grid +when backgrounds are updated. +--- + extensions/desktop-icons/desktopManager.js | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/extensions/desktop-icons/desktopManager.js b/extensions/desktop-icons/desktopManager.js +index 08bc82b7..74d0e6bd 100644 +--- a/extensions/desktop-icons/desktopManager.js ++++ b/extensions/desktop-icons/desktopManager.js +@@ -83,7 +83,6 @@ var DesktopManager = GObject.registerClass({ + this._discreteGpuAvailable = false; + this._rubberBandActive = false; + +- this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', () => this._recreateDesktopIcons()); + this._rubberBand = new St.Widget({ style_class: 'rubber-band' }); + this._rubberBand.hide(); + Main.layoutManager._backgroundGroup.add_child(this._rubberBand); +@@ -109,6 +108,13 @@ var DesktopManager = GObject.registerClass({ + return origCapturedEvent.bind(this._grabHelper)(event); + }; + ++ this._origUpdateBackgrounds = ++ Main.layoutManager._updateBackgrounds; ++ Main.layoutManager._updateBackgrounds = () => { ++ this._origUpdateBackgrounds.call(Main.layoutManager); ++ this._recreateDesktopIcons(); ++ }; ++ + this._addDesktopIcons(); + this._monitorDesktopFolder(); + +@@ -843,9 +849,10 @@ var DesktopManager = GObject.registerClass({ + GLib.source_remove(this._deleteChildrenId); + this._deleteChildrenId = 0; + +- if (this._monitorsChangedId) +- Main.layoutManager.disconnect(this._monitorsChangedId); +- this._monitorsChangedId = 0; ++ if (this._origUpdateBackgrounds) ++ Main.layoutManager._updateBackgrounds = this._origUpdateBackgrounds; ++ delete this._origUpdateBackgrounds; ++ + if (this._stageReleaseEventId) + global.stage.disconnect(this._stageReleaseEventId); + this._stageReleaseEventId = 0; +-- +2.38.1 + diff --git a/desktop-icons-Make-resilient-to-background-reloads.patch b/desktop-icons-Make-resilient-to-background-reloads.patch new file mode 100644 index 0000000..abe785e --- /dev/null +++ b/desktop-icons-Make-resilient-to-background-reloads.patch @@ -0,0 +1,52 @@ +From 5c3737cd0c5a9e60064246d3ae4a8811e617be89 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Fri, 16 Dec 2022 22:30:35 +0100 +Subject: [PATCH] New try + +--- + extensions/desktop-icons/desktopManager.js | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/extensions/desktop-icons/desktopManager.js b/extensions/desktop-icons/desktopManager.js +index 08bc82b7..d2713b6b 100644 +--- a/extensions/desktop-icons/desktopManager.js ++++ b/extensions/desktop-icons/desktopManager.js +@@ -83,7 +83,6 @@ var DesktopManager = GObject.registerClass({ + this._discreteGpuAvailable = false; + this._rubberBandActive = false; + +- this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', () => this._recreateDesktopIcons()); + this._rubberBand = new St.Widget({ style_class: 'rubber-band' }); + this._rubberBand.hide(); + Main.layoutManager._backgroundGroup.add_child(this._rubberBand); +@@ -109,6 +108,13 @@ var DesktopManager = GObject.registerClass({ + return origCapturedEvent.bind(this._grabHelper)(event); + }; + ++ this._origUpdateBackgrounds = ++ Main.layoutManager.prototype._updateBackgrounds; ++ Main.layoutManager.prototype._updateBackgrounds = () => { ++ this._origUpdateBackgrounds.call(Main.layoutManager); ++ this._recreateDesktopIcons(); ++ }; ++ + this._addDesktopIcons(); + this._monitorDesktopFolder(); + +@@ -843,9 +849,10 @@ var DesktopManager = GObject.registerClass({ + GLib.source_remove(this._deleteChildrenId); + this._deleteChildrenId = 0; + +- if (this._monitorsChangedId) +- Main.layoutManager.disconnect(this._monitorsChangedId); +- this._monitorsChangedId = 0; ++ if (this._origUpdateBackgrounds) ++ Main.layoutManager.prototype._updateBackgrounds = this._origUpdateBackgrounds; ++ delete this._origUpdateBackgrounds; ++ + if (this._stageReleaseEventId) + global.stage.disconnect(this._stageReleaseEventId); + this._stageReleaseEventId = 0; +-- +2.38.1 + diff --git a/gnome-shell-extensions.spec b/gnome-shell-extensions.spec index a04321b..c22158e 100644 --- a/gnome-shell-extensions.spec +++ b/gnome-shell-extensions.spec @@ -36,6 +36,7 @@ Patch013: 0001-desktop-icons-Fix-stuck-grab-issue-with-rubber-bandi.patch Patch014: window-list-touch.patch Patch015: 0001-classification-banner-Handle-fullscreen-monitors.patch Patch016: 0001-desktop-icons-Don-t-grab-focus-on-click.patch +Patch017: 0001-desktopManager-Hook-into-LayoutManager-to-create-gri.patch %description GNOME Shell Extensions is a collection of extensions providing additional and @@ -414,6 +415,8 @@ workspaces. Resolves: #2153524 - Don't grab focus when clicking desktop grid Resolves: #2150001 +- Make desktop icons resilient to background reloads + Resolves: #2139895 * Wed Jun 22 2022 Florian Müllner - 40.7-3 - Improve window-list on touch