overviewControls: Do consider work area for HIDDEN state

While we don't want to position overview elements according to
the work area, it does apply in the session when the overview
is hidden. That is, we should take it into account for the HIDDEN
state, so that transitions from and to the overview are correct.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2223>
This commit is contained in:
Florian Müllner 2022-03-05 13:42:21 +01:00 committed by Marge Bot
parent a30363140c
commit 5d1d4b56c6

View File

@ -47,14 +47,17 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
stateAdjustment.connect('notify::value', () => this.layout_changed()); stateAdjustment.connect('notify::value', () => this.layout_changed());
} }
_computeWorkspacesBoxForState(state, box, startY, searchHeight, dashHeight, thumbnailsHeight) { _computeWorkspacesBoxForState(state, box, workAreaBox, searchHeight, dashHeight, thumbnailsHeight) {
const workspaceBox = box.copy(); const workspaceBox = box.copy();
const [width, height] = workspaceBox.get_size(); const [width, height] = workspaceBox.get_size();
const { y1: startY } = workAreaBox;
const { spacing } = this; const { spacing } = this;
const { expandFraction } = this._workspacesThumbnails; const { expandFraction } = this._workspacesThumbnails;
switch (state) { switch (state) {
case ControlsState.HIDDEN: case ControlsState.HIDDEN:
workspaceBox.set_origin(...workAreaBox.get_origin());
workspaceBox.set_size(...workAreaBox.get_size());
break; break;
case ControlsState.WINDOW_PICKER: case ControlsState.WINDOW_PICKER:
workspaceBox.set_origin(0, workspaceBox.set_origin(0,
@ -77,8 +80,9 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
return workspaceBox; return workspaceBox;
} }
_getAppDisplayBoxForState(state, box, startY, searchHeight, dashHeight, appGridBox) { _getAppDisplayBoxForState(state, box, workAreaBox, searchHeight, dashHeight, appGridBox) {
const [width, height] = box.get_size(); const [width, height] = box.get_size();
const { y1: startY } = workAreaBox;
const appDisplayBox = new Clutter.ActorBox(); const appDisplayBox = new Clutter.ActorBox();
const { spacing } = this; const { spacing } = this;
@ -133,7 +137,11 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
const monitor = Main.layoutManager.findMonitorForActor(this._container); const monitor = Main.layoutManager.findMonitorForActor(this._container);
const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor.index); const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor.index);
const startX = workArea.x - monitor.x;
const startY = workArea.y - monitor.y; const startY = workArea.y - monitor.y;
const workAreaBox = new Clutter.ActorBox();
workAreaBox.set_origin(startX, startY);
workAreaBox.set_size(workArea.width, workArea.height);
box.y1 += startY; box.y1 += startY;
const [width, height] = box.get_size(); const [width, height] = box.get_size();
let availableHeight = height; let availableHeight = height;
@ -173,7 +181,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
} }
// Workspaces // Workspaces
let params = [box, startY, searchHeight, dashHeight, thumbnailsHeight]; let params = [box, workAreaBox, searchHeight, dashHeight, thumbnailsHeight];
const transitionParams = this._stateAdjustment.getStateTransitionParams(); const transitionParams = this._stateAdjustment.getStateTransitionParams();
// Update cached boxes // Update cached boxes
@ -198,7 +206,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
const workspaceAppGridBox = const workspaceAppGridBox =
this._cachedWorkspaceBoxes.get(ControlsState.APP_GRID); this._cachedWorkspaceBoxes.get(ControlsState.APP_GRID);
params = [box, startY, searchHeight, dashHeight, workspaceAppGridBox]; params = [box, workAreaBox, searchHeight, dashHeight, workspaceAppGridBox];
let appDisplayBox; let appDisplayBox;
if (!transitionParams.transitioning) { if (!transitionParams.transitioning) {
appDisplayBox = appDisplayBox =