[gnome-shell/T27795: 106/138] iconGrid: Adapt calculation of space between icons and pages



commit c3a6bf2f9dfc1f454271be382aaae9bcfced52c1
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Wed Feb 7 15:44:34 2018 +0000

    iconGrid: Adapt calculation of space between icons and pages
    
    Again, the upstream shell calculates the amount of space between icons
    dynamically depending on the available size of the screen, but we want
    to have a fixed size grid, so let's remove that code to allow
    enforcing our preference from the CSS file.
    
    https://phabricator.endlessm.com/T17658

 data/theme/gnome-shell-sass/_endless.scss |  5 +++++
 js/ui/iconGrid.js                         | 34 -------------------------------
 2 files changed, 5 insertions(+), 34 deletions(-)
---
diff --git a/data/theme/gnome-shell-sass/_endless.scss b/data/theme/gnome-shell-sass/_endless.scss
index 74a73c1ca6..140e0af7d8 100644
--- a/data/theme/gnome-shell-sass/_endless.scss
+++ b/data/theme/gnome-shell-sass/_endless.scss
@@ -391,8 +391,13 @@ popup-separator-menu-item {
 }
 
 .icon-grid {
+    spacing: 10px;
+    -shell-grid-horizontal-item-size: 118px;
+    -shell-grid-vertical-item-size: 118px;
+
     .overview-icon {
         icon-size: 64px;
+        spacing: 8px;
         border-radius: 15px;
         font-weight: bold;
     }
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 474a9adf59..04a2b011b1 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -687,39 +687,6 @@ var IconGrid = GObject.registerClass({
         return this._fixedVItemSize ? this._fixedVItemSize : this._vItemSize;
     }
 
-    _updateSpacingForSize(availWidth, availHeight) {
-        let maxEmptyVArea = availHeight - this._minRows * this._getVItemSize();
-        let maxEmptyHArea = availWidth - this._minColumns * this._getHItemSize();
-        let maxHSpacing, maxVSpacing;
-
-        if (this._padWithSpacing) {
-            // minRows + 1 because we want to put spacing before the first row, so it is like we have one 
more row
-            // to divide the empty space
-            maxVSpacing = Math.floor(maxEmptyVArea / (this._minRows + 1));
-            maxHSpacing = Math.floor(maxEmptyHArea / (this._minColumns + 1));
-        } else {
-            if (this._minRows <=  1)
-                maxVSpacing = maxEmptyVArea;
-            else
-                maxVSpacing = Math.floor(maxEmptyVArea / (this._minRows - 1));
-
-            if (this._minColumns <=  1)
-                maxHSpacing = maxEmptyHArea;
-            else
-                maxHSpacing = Math.floor(maxEmptyHArea / (this._minColumns - 1));
-        }
-
-        let maxSpacing = Math.min(maxHSpacing, maxVSpacing);
-        // Limit spacing to the item size
-        maxSpacing = Math.min(maxSpacing, Math.min(this._getVItemSize(), this._getHItemSize()));
-        // The minimum spacing, regardless of whether it satisfies the row/columng minima,
-        // is the spacing we get from CSS.
-        let spacing = Math.max(this._spacing, maxSpacing);
-        this.setSpacing(spacing);
-        if (this._padWithSpacing)
-            this.topPadding = this.rightPadding = this.bottomPadding = this.leftPadding = spacing;
-    }
-
     /**
      * This function must to be called before iconGrid allocation,
      * to know how much spacing can the grid has
@@ -727,7 +694,6 @@ var IconGrid = GObject.registerClass({
     adaptToSize(availWidth, availHeight) {
         this._fixedHItemSize = this._hItemSize;
         this._fixedVItemSize = this._vItemSize;
-        this._updateSpacingForSize(availWidth, availHeight);
     }
 });
 


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