Make desktop-icons resilient against background reloads

Resolves: #2139895
This commit is contained in:
Florian Müllner 2022-12-16 17:57:40 +01:00
parent 8609634ee4
commit bce0c1798c
3 changed files with 115 additions and 0 deletions

View File

@ -0,0 +1,60 @@
From 62289dff5cb2e615a277b72f034fa42f45aad639 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
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

View File

@ -0,0 +1,52 @@
From 5c3737cd0c5a9e60064246d3ae4a8811e617be89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
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

View File

@ -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 <fmuellner@redhat.com> - 40.7-3
- Improve window-list on touch