[gnome-shell] iconGrid: Make sure the style is updated before computing the layout



commit 8f0e9abe47d3835a1e8861c85a0e642dd2a52f8b
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Sun Nov 25 00:57:00 2018 +0100

    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();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]