diff -Nru gnome-shell-extension-desktop-icons-20.04.0/debian/changelog gnome-shell-extension-desktop-icons-20.04.0/debian/changelog --- gnome-shell-extension-desktop-icons-20.04.0/debian/changelog 2020-05-19 12:17:45.000000000 +0000 +++ gnome-shell-extension-desktop-icons-20.04.0/debian/changelog 2020-07-21 16:30:14.000000000 +0000 @@ -1,3 +1,17 @@ +gnome-shell-extension-desktop-icons (20.04.0-3~ubuntu20.04.1) focal; urgency=medium + + * No-change backport to focal + + -- Marco Trevisan (Treviño) Tue, 21 Jul 2020 18:30:14 +0200 + +gnome-shell-extension-desktop-icons (20.04.0-3) unstable; urgency=medium + + * d/p/Fix-incorrect-aspect-ratio.patch, + d/p/desktopGrid.js-fix-errors-when-screen-size-changes.patch: + - Fix incorrect icon aspect ratio (LP: #1880031) + + -- Marco Trevisan (Treviño) Tue, 21 Jul 2020 18:16:08 +0200 + gnome-shell-extension-desktop-icons (20.04.0-2~ubuntu20.04.1) focal; urgency=medium * Backport to focal diff -Nru gnome-shell-extension-desktop-icons-20.04.0/debian/patches/desktopGrid.js-fix-errors-when-screen-size-changes.patch gnome-shell-extension-desktop-icons-20.04.0/debian/patches/desktopGrid.js-fix-errors-when-screen-size-changes.patch --- gnome-shell-extension-desktop-icons-20.04.0/debian/patches/desktopGrid.js-fix-errors-when-screen-size-changes.patch 1970-01-01 00:00:00.000000000 +0000 +++ gnome-shell-extension-desktop-icons-20.04.0/debian/patches/desktopGrid.js-fix-errors-when-screen-size-changes.patch 2020-07-21 16:30:14.000000000 +0000 @@ -0,0 +1,87 @@ +From: Sergio Costas +Date: Sat, 23 May 2020 17:07:11 +0200 +Subject: desktopGrid.js: fix errors when screen size changes + +When the screen size changes (like when a dock is added/removed/ +changes possition, or when resolution changes), a lot of errors +are shown. This is because when the grid is reset and the icons +are removed from it, it uses the new size instead the old one +to calculate the number of elements in the grid. This results +in jumping over some locations of the grid, and trying to check +inexistent ones, and thus errors because some elements aren't +removed from the grid. + +This patch fixes it by storing the size of the grid during the +initialization, and using that stored value for all operations +untill the grid is reinitialized with a new size. + +Bug-Ubuntu: http://bugs.launchpad.net/bugs/1880031 +Origin: https://gitlab.gnome.org/World/ShellExtensions/desktop-icons/-/commit/d5f05997 +--- + desktopGrid.js | 26 ++++++++++++-------------- + 1 file changed, 12 insertions(+), 14 deletions(-) + +diff --git a/desktopGrid.js b/desktopGrid.js +index fb30be9..4613428 100644 +--- a/desktopGrid.js ++++ b/desktopGrid.js +@@ -424,25 +424,23 @@ var DesktopGrid = GObject.registerClass({ + } + + _getEmptyPlaceClosestTo(x, y, coordinatesAction) { +- let maxColumns = this._getMaxColumns(); +- let maxRows = this._getMaxRows(); + + let [actorX, actorY] = this._grid.get_transformed_position(); + let actorWidth = this._grid.allocation.x2 - this._grid.allocation.x1; + let actorHeight = this._grid.allocation.y2 - this._grid.allocation.y1; +- let placeX = Math.round((x - actorX) * maxColumns / actorWidth); +- let placeY = Math.round((y - actorY) * maxRows / actorHeight); ++ let placeX = Math.round((x - actorX) * this._columns / actorWidth); ++ let placeY = Math.round((y - actorY) * this._rows / actorHeight); + +- placeX = DesktopIconsUtil.clamp(placeX, 0, maxColumns - 1); +- placeY = DesktopIconsUtil.clamp(placeY, 0, maxRows - 1); ++ placeX = DesktopIconsUtil.clamp(placeX, 0, this._columns - 1); ++ placeY = DesktopIconsUtil.clamp(placeY, 0, this._rows - 1); + if (this.layout.get_child_at(placeX, placeY).child == null) + return [placeX, placeY]; + let found = false; + let resColumn = null; + let resRow = null; + let minDistance = Infinity; +- for (let column = 0; column < maxColumns; column++) { +- for (let row = 0; row < maxRows; row++) { ++ for (let column = 0; column < this._columns; column++) { ++ for (let row = 0; row < this._rows; row++) { + let placeholder = this.layout.get_child_at(column, row); + if (placeholder.child != null) + continue; +@@ -482,8 +480,10 @@ var DesktopGrid = GObject.registerClass({ + } + + _fillPlaceholders() { +- for (let column = 0; column < this._getMaxColumns(); column++) { +- for (let row = 0; row < this._getMaxRows(); row++) { ++ this._rows = this._getMaxRows(); ++ this._columns = this._getMaxColumns(); ++ for (let column = 0; column < this._columns; column++) { ++ for (let row = 0; row < this._rows; row++) { + this.layout.attach(new Placeholder(), column, row, 1, 1); + } + } +@@ -569,12 +569,10 @@ var DesktopGrid = GObject.registerClass({ + throw new Error('Error at _getPosOfFileItem: child cannot be null'); + + let found = false; +- let maxColumns = this._getMaxColumns(); +- let maxRows = this._getMaxRows(); + let column = 0; + let row = 0; +- for (column = 0; column < maxColumns; column++) { +- for (row = 0; row < maxRows; row++) { ++ for (column = 0; column < this._columns; column++) { ++ for (row = 0; row < this._rows; row++) { + let item = this.layout.get_child_at(column, row); + if (item.child && item.child.file.equal(itemToFind.file)) { + found = true; diff -Nru gnome-shell-extension-desktop-icons-20.04.0/debian/patches/Fix-incorrect-aspect-ratio.patch gnome-shell-extension-desktop-icons-20.04.0/debian/patches/Fix-incorrect-aspect-ratio.patch --- gnome-shell-extension-desktop-icons-20.04.0/debian/patches/Fix-incorrect-aspect-ratio.patch 1970-01-01 00:00:00.000000000 +0000 +++ gnome-shell-extension-desktop-icons-20.04.0/debian/patches/Fix-incorrect-aspect-ratio.patch 2020-07-21 16:30:14.000000000 +0000 @@ -0,0 +1,74 @@ +From: Sergio Costas +Date: Sun, 24 May 2020 08:55:32 +0000 +Subject: Fix incorrect aspect ratio + +Narrow icons were shown stretched. This patch fixes it. + +Fix https://gitlab.gnome.org/World/ShellExtensions/desktop-icons/-/issues/205 + +Bug-Ubuntu: http://bugs.launchpad.net/bugs/1880031 +Origin: https://gitlab.gnome.org/World/ShellExtensions/desktop-icons/-/commit/d5f05997 +--- + fileItem.js | 26 +++++++++++++++++++++++--- + 1 file changed, 23 insertions(+), 3 deletions(-) + +diff --git a/fileItem.js b/fileItem.js +index ff94ee9..d38900a 100644 +--- a/fileItem.js ++++ b/fileItem.js +@@ -101,6 +101,17 @@ var FileItem = GObject.registerClass({ + this.set_child(this._container); + this._icon = new St.Bin(); + this._icon.set_height(Prefs.get_icon_size() * scaleFactor); ++ this._iconAllocationIdleId = 0; ++ this._iconAllocationId = this._icon.connect("allocation-changed", () => { ++ if (this._iconAllocationIdleId) ++ GLib.source_remove(this._iconAllocationIdleId); ++ this._iconAllocationIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => { ++ GLib.source_remove(this._iconAllocationIdleId); ++ this._iconAllocationIdleId = 0; ++ this._updateIcon(); ++ return GLib.SOURCE_REMOVE; ++ }); ++ }); + + this._iconContainer = new St.Bin({ visible: true }); + this._iconContainer.child = this._icon; +@@ -206,6 +217,11 @@ var FileItem = GObject.registerClass({ + if (this._scheduleTrashRefreshId) + GLib.source_remove(this._scheduleTrashRefreshId); + ++ /* Icon */ ++ this._icon.disconnect(this._iconAllocationId); ++ if (this._iconAllocationIdleId) ++ GLib.source_remove(this._iconAllocationIdleId); ++ + /* Menu */ + this._removeMenu(); + } +@@ -345,18 +361,22 @@ var FileItem = GObject.registerClass({ + ); + let icon = new Clutter.Actor(); + icon.set_content(thumbnailImage); +- let containerWidth = Prefs.getDesiredWidth(scaleFactor, 0); ++ let containerWidth = (this._icon.allocation.x2 - this._icon.allocation.x1) * scaleFactor; + let containerHeight = Prefs.get_icon_size() * scaleFactor; + let containerAspectRatio = containerWidth / containerHeight; + let iconAspectRatio = thumbnailPixbuf.width / thumbnailPixbuf.height; + if (containerAspectRatio > iconAspectRatio) { + let iconWidth = containerHeight * iconAspectRatio; + icon.set_size(iconWidth, containerHeight); +- icon.margin_left = icon.margin_right = Math.floor((containerWidth - iconWidth) / 2); ++ let margin = (containerWidth - iconWidth) / 2; ++ icon.margin_left = Math.ceil(margin); ++ icon.margin_right = Math.floor(margin); + } else { + let iconHeight = containerWidth / iconAspectRatio; + icon.set_size(containerWidth, iconHeight); +- icon.margin_top = icon.margin_bottom = Math.floor((containerHeight - iconHeight) / 2); ++ let margin = (containerHeight - iconHeight) / 2; ++ icon.margin_top = Math.ceil(margin); ++ icon.margin_bottom = Math.floor(margin); + } + this._icon.child = icon; + } diff -Nru gnome-shell-extension-desktop-icons-20.04.0/debian/patches/series gnome-shell-extension-desktop-icons-20.04.0/debian/patches/series --- gnome-shell-extension-desktop-icons-20.04.0/debian/patches/series 2020-05-19 12:17:45.000000000 +0000 +++ gnome-shell-extension-desktop-icons-20.04.0/debian/patches/series 2020-07-21 16:30:14.000000000 +0000 @@ -20,3 +20,5 @@ desktopGrid.js-fix-number-of-parameters.patch general-Fix-key-symbols.patch fileItem.js-Refresh-thumbnails-if-file-changes.patch +desktopGrid.js-fix-errors-when-screen-size-changes.patch +Fix-incorrect-aspect-ratio.patch