overviewControls: Cache workspaces boxes
Next commit will need to access the allocated workspaces boxes, so cache them at allocation time. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1624>
This commit is contained in:
parent
6870f3ccb4
commit
9c6d8e2aad
@ -37,6 +37,8 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
this._viewSelector = viewSelector;
|
this._viewSelector = viewSelector;
|
||||||
this._dash = dash;
|
this._dash = dash;
|
||||||
|
|
||||||
|
this._cachedWorkspaceBoxes = new Map();
|
||||||
|
|
||||||
stateAdjustment.connect('notify::value', () => this.layout_changed());
|
stateAdjustment.connect('notify::value', () => this.layout_changed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,15 +142,18 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
let params = [box, searchHeight, dashHeight, thumbnailsHeight];
|
let params = [box, searchHeight, dashHeight, thumbnailsHeight];
|
||||||
const transitionParams = this._stateAdjustment.getStateTransitionParams();
|
const transitionParams = this._stateAdjustment.getStateTransitionParams();
|
||||||
|
|
||||||
|
// Update cached boxes
|
||||||
|
for (const state of Object.values(ControlsState)) {
|
||||||
|
this._cachedWorkspaceBoxes.set(
|
||||||
|
state, this._getWorkspacesBoxForState(state, ...params));
|
||||||
|
}
|
||||||
|
|
||||||
let workspacesBox;
|
let workspacesBox;
|
||||||
if (!transitionParams.transitioning) {
|
if (!transitionParams.transitioning) {
|
||||||
workspacesBox =
|
workspacesBox = this._cachedWorkspaceBoxes.get(transitionParams.currentState);
|
||||||
this._getWorkspacesBoxForState(transitionParams.currentState, ...params);
|
|
||||||
} else {
|
} else {
|
||||||
const initialBox =
|
const initialBox = this._cachedWorkspaceBoxes.get(transitionParams.initialState);
|
||||||
this._getWorkspacesBoxForState(transitionParams.initialState, ...params);
|
const finalBox = this._cachedWorkspaceBoxes.get(transitionParams.finalState);
|
||||||
const finalBox =
|
|
||||||
this._getWorkspacesBoxForState(transitionParams.finalState, ...params);
|
|
||||||
workspacesBox = initialBox.interpolate(finalBox, transitionParams.progress);
|
workspacesBox = initialBox.interpolate(finalBox, transitionParams.progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +161,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
|
|
||||||
// AppDisplay
|
// AppDisplay
|
||||||
const workspaceAppGridBox =
|
const workspaceAppGridBox =
|
||||||
this._getWorkspacesBoxForState(ControlsState.APP_GRID, ...params);
|
this._cachedWorkspaceBoxes.get(ControlsState.APP_GRID);
|
||||||
|
|
||||||
params = [box, searchHeight, dashHeight, workspaceAppGridBox];
|
params = [box, searchHeight, dashHeight, workspaceAppGridBox];
|
||||||
let appDisplayBox;
|
let appDisplayBox;
|
||||||
|
Loading…
Reference in New Issue
Block a user