appDisplay: Adapt to available extra space showing icon grids

Depending on the available horizontal space, we may want to manipulate
the icon grid and scroll view spacing to result in an optimal layout
that has space left to preview prev/next pages.

The main change here is that, when adapting to the available size, the
space given to a page does not necessarily match the available space,
as we need to be able to show more than one page at a time.

With this decoupling of available and page sizes in place, we now know
how much space there is available in order to extend the padding between
pages, or the fade effect applied to the previewed pages.

Underneath, we rely a bit less on hardcoded CSS paddings, and a bit more
on the StScrollView::content-padding property.

All put together, gives us proper space management from ultra-wide
displays, to display ratios that are close to the optimal grid ratio.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1630>
This commit is contained in:
Carlos Garnacho
2021-02-19 16:45:57 +01:00
committed by Marge Bot
parent ffe11e0560
commit 9e5b357b0b
3 changed files with 99 additions and 25 deletions

View File

@@ -1223,7 +1223,7 @@ var IconGrid = GObject.registerClass({
}
}
_findBestModeForSize(width, height) {
findBestModeForSize(width, height) {
const { pagePadding } = this.layout_manager;
width -= pagePadding.left + pagePadding.right;
height -= pagePadding.top + pagePadding.bottom;
@@ -1446,7 +1446,6 @@ var IconGrid = GObject.registerClass({
}
adaptToSize(width, height) {
this._findBestModeForSize(width, height);
this.layout_manager.adaptToSize(width, height);
}