From 8f0e9abe47d3835a1e8861c85a0e642dd2a52f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Sun, 25 Nov 2018 00:57:00 +0100 Subject: [PATCH] iconGrid: Make sure the style is updated before computing the layout In some cases the style-changed signal hasn't been emitted when _computeLayout() is called, resulting in the use of the default spacing and item size values for the calculations. One case where this happens is when starting a search. Right after the initialization of GridSearchResults, _computeLayout() is called from _getMaxDisplayedResults() and the style-changed signal hasn't been emitted yet. The computed layout will be wrong and the maximum number of results will also be wrong. To prevent this from happening, make sure the style has been updated before doing the calculations in _computeLayout(). https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/110 --- js/ui/iconGrid.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index 3c0bd3cd2..9a6ddc586 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -602,6 +602,8 @@ var IconGrid = GObject.registerClass({ } _computeLayout(forWidth) { + this.ensure_style(); + let nColumns = 0; let usedWidth = this.leftPadding + this.rightPadding; let spacing = this._getSpacing();