[gnome-shell] workspace: Force creating new layout when there's no allocation yet



commit b17f00cfb1196946232b9733e315cb91f27cbb26
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Wed Mar 9 10:14:42 2022 +0100

    workspace: Force creating new layout when there's no allocation yet
    
    Commit ba23279f1fd3820fb81570b1b4a03048e5a7a3bc was aimed at fixing a
    bug where the layout is frozen so early that we don't have an existing
    one to re-use, because no allocation cycle happened yet. It tried to fix
    that by forcing the creation of a layout when needsLayout === true,
    this turned out to be a bit too much, as it also forced creating a new
    layout when the layout was frozen after closing a window (which would
    set needsLayout to true).
    
    To fix this regression and still avoid reintroducing the bug the
    previous commit fixed, tighten the check a bit and only force creating
    the new layout when there's no allocation yet. This makes freezing the
    layout after closing a window work again.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2236>

 js/ui/workspace.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index ebf3d9ba38..60e0d44a84 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -628,7 +628,6 @@ var WorkspaceLayout = GObject.registerClass({
         const [containerWidth, containerHeight] = containerBox.get_size();
         const containerAllocationChanged =
             this._lastBox === null || !this._lastBox.equal(containerBox);
-        this._lastBox = containerBox.copy();
 
         // If the containers size changed, we can no longer keep around
         // the old windowSlots, so we must unfreeze the layout.
@@ -665,7 +664,7 @@ var WorkspaceLayout = GObject.registerClass({
         }
 
         let layoutChanged = false;
-        if (!this._layoutFrozen || this._needsLayout) {
+        if (!this._layoutFrozen || !this._lastBox) {
             if (this._needsLayout) {
                 this._layout = this._createBestLayout(this._workarea);
                 this._needsLayout = false;
@@ -765,6 +764,8 @@ var WorkspaceLayout = GObject.registerClass({
                 child.allocate(childBox);
             }
         }
+
+        this._lastBox = containerBox.copy();
     }
 
     _syncOverlay(preview) {


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