[gnome-shell] workspace: Ensure that _createBestLayout() always returns a layout



commit c01973055f994bd6ce89e6790756be3ad5dafebc
Author: Sebastian Keller <skeller gnome org>
Date:   Tue Feb 16 13:37:17 2021 +0100

    workspace: Ensure that _createBestLayout() always returns a layout
    
    When opening a large number of windows, the computed space and scale for
    a layout can become negative due to the per-row/per-column spacing. This
    is smaller than the initial values of lastSpace and lastSpace, leading
    to a null return which then causes all sorts of other issues resulting
    in the workspace becoming invisible.
    
    This change ensures that the function always returns a layout, even if
    it may look a bit broken and does not conform to the scale/space
    requirements which are impossible to fulfill for the given number of
    windows. It's better than displaying nothing, since it allows users to
    move/close windows and restore this to a more usable state.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3730
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1685>

 js/ui/workspace.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index f9f9e51ee2..6bf5cfe26f 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -518,7 +518,7 @@ var WorkspaceLayout = GObject.registerClass({
 
             const [scale, space] = this._layoutStrategy.computeScaleAndSpace(layout, area);
 
-            if (!this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space))
+            if (lastLayout && !this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space))
                 break;
 
             lastLayout = layout;


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