[gnome-shell/eos3.8: 91/255] iconGrid: Don't consider unused vertical space for preferred height



commit 5bbc2e34658c1877f8ffb90d933fc7a5dfc1833e
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Tue Jun 20 15:48:08 2017 +0100

    iconGrid: Don't consider unused vertical space for preferred height
    
    Upstream always considers all the space to report the preferred
    height, even if there are no enough icons to fill it. This causes
    problems with our desired layout where we want to pack the icon
    grid centered under the desktop search actor, since the grid will
    try to take up all the possible allocation, pushing the search
    entry to the top of the desktop.
    
    This fixes this situation by not requesting more height than what
    is actually needed. This means that icons will be pushed outside
    of the allocated space for the grid when opening a folder, which
    is not ideal, but probably good enough for now (and something that
    can be fixed as a separate ticket). To prevent some too extreme
    situations, though, we set the minimum amount of rows to 2, so that
    we always leave space for folders in case we only have one row.
    
    https://phabricator.endlessm.com/T17658

 js/ui/appDisplay.js | 6 +++++-
 js/ui/iconGrid.js   | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index bc2ba87759..96203eaea2 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -25,7 +25,7 @@ const { loadInterfaceXML } = imports.misc.fileUtils;
 var MENU_POPUP_TIMEOUT = 600;
 var MAX_COLUMNS = 7;
 var MIN_COLUMNS = 4;
-var MIN_ROWS = 4;
+var MIN_ROWS = 1;
 
 var INACTIVE_GRID_OPACITY = 77;
 // This time needs to be less than IconGrid.EXTRA_SPACE_ANIMATION_TIME
@@ -55,6 +55,8 @@ let discreteGpuAvailable = false;
 
 // Endless-specific definitions below this point
 
+const EOS_DESKTOP_MIN_ROWS = 2;
+
 const EOS_LINK_PREFIX = 'eos-link-';
 
 const EOS_APP_CENTER_ID = 'org.gnome.Software.desktop';
@@ -305,6 +307,8 @@ class AppDisplay extends BaseAppView {
             x_expand: true,
             y_expand: true,
             use_pagination: true,
+        }, {
+            minRows: EOS_DESKTOP_MIN_ROWS,
         });
 
         this._scrollView = new St.ScrollView({
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 6aa61fa88a..c331227d40 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -772,7 +772,7 @@ class PaginatedIconGrid extends IconGrid {
             nRows = Math.min(nRows, this._rowLimit);
 
         // We want to contain the grid inside the parent box with padding
-        this._rowsPerPage = this.rowsForHeight(availHeightPerPage);
+        this._rowsPerPage = Math.min(Math.max (this._minRows, nRows), 
this.rowsForHeight(availHeightPerPage));
         this._nPages = Math.ceil(nRows / this._rowsPerPage);
 
         if (this._nPages > 1)


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