workspace: Don't store strategy on layout object

We're making the layout object fully owned by the layout strategy, so
store the current strategy somewhere else, that is as a private property
of the class.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1617>
This commit is contained in:
Jonas Dreßler 2021-02-01 11:40:50 +01:00 committed by Marge Bot
parent 39e844ac0c
commit a4bf44734d

View File

@ -487,7 +487,7 @@ var WorkspaceLayout = GObject.registerClass({
// We look for the largest scale that allows us to fit the // We look for the largest scale that allows us to fit the
// largest row/tallest column on the workspace. // largest row/tallest column on the workspace.
const strategy = new UnalignedLayoutStrategy({ this._layoutStrategy = new UnalignedLayoutStrategy({
monitor: Main.layoutManager.monitors[this._monitorIndex], monitor: Main.layoutManager.monitors[this._monitorIndex],
rowSpacing, rowSpacing,
columnSpacing, columnSpacing,
@ -507,12 +507,11 @@ var WorkspaceLayout = GObject.registerClass({
if (numColumns === lastNumColumns) if (numColumns === lastNumColumns)
break; break;
const layout = strategy.computeLayout(this._sortedWindows, { const layout = this._layoutStrategy.computeLayout(this._sortedWindows, {
numRows, numRows,
}); });
layout.strategy = strategy;
const [scale, space] = strategy.computeScaleAndSpace(layout, area); const [scale, space] = this._layoutStrategy.computeScaleAndSpace(layout, area);
if (!this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space)) if (!this._isBetterScaleAndSpace(lastScale, lastSpace, scale, space))
break; break;
@ -537,7 +536,7 @@ var WorkspaceLayout = GObject.registerClass({
height: parseInt(containerBox.get_height()), height: parseInt(containerBox.get_height()),
}; };
return this._layout.strategy.computeWindowSlots(this._layout, availArea); return this._layoutStrategy.computeWindowSlots(this._layout, availArea);
} }
_getAdjustedWorkarea(container) { _getAdjustedWorkarea(container) {