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>
This commit is contained in:
parent
901ecfb619
commit
c01973055f
@ -518,7 +518,7 @@ var WorkspaceLayout = GObject.registerClass({
|
|||||||
|
|
||||||
const [scale, space] = this._layoutStrategy.computeScaleAndSpace(layout, area);
|
const [scale, space] = this._layoutStrategy.computeScaleAndSpace(layout, area);
|
||||||
|
|
||||||
if (!this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space))
|
if (lastLayout && !this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
lastLayout = layout;
|
lastLayout = layout;
|
||||||
|
Loading…
Reference in New Issue
Block a user