overviewControls: Ignore work area again

The work area is really the space that is available to application
windows. Applying it to the overview is therefore questionable,
in particular given that

 - X11 clients that affect struts aren't shown
 - elements added by extensions have other means
   to affect the overview layout

Not applying the work area to the overview also makes ignoring
actors' visibility for struts acceptable again: Assuming that
strut actors are only hidden when the monitor is in fullscreen,
freezing the work area instead of updating it for windows that
are fully obscured by a fullscreen windows makes perfect sense.

This reverts commits 81a1e294f8 and 2b074882f4.

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

View File

@ -47,9 +47,8 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
stateAdjustment.connect('notify::value', () => this.layout_changed()); stateAdjustment.connect('notify::value', () => this.layout_changed());
} }
_computeWorkspacesBoxForState(state, workAreaBox, searchHeight, dashHeight, thumbnailsHeight) { _computeWorkspacesBoxForState(state, box, startY, searchHeight, dashHeight, thumbnailsHeight) {
const workspaceBox = workAreaBox.copy(); const workspaceBox = box.copy();
const [startX, startY] = workAreaBox.get_origin();
const [width, height] = workspaceBox.get_size(); const [width, height] = workspaceBox.get_size();
const { spacing } = this; const { spacing } = this;
const { expandFraction } = this._workspacesThumbnails; const { expandFraction } = this._workspacesThumbnails;
@ -58,7 +57,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
case ControlsState.HIDDEN: case ControlsState.HIDDEN:
break; break;
case ControlsState.WINDOW_PICKER: case ControlsState.WINDOW_PICKER:
workspaceBox.set_origin(startX, workspaceBox.set_origin(0,
startY + searchHeight + spacing + startY + searchHeight + spacing +
thumbnailsHeight + spacing * expandFraction); thumbnailsHeight + spacing * expandFraction);
workspaceBox.set_size(width, workspaceBox.set_size(width,
@ -68,7 +67,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
thumbnailsHeight - spacing * expandFraction); thumbnailsHeight - spacing * expandFraction);
break; break;
case ControlsState.APP_GRID: case ControlsState.APP_GRID:
workspaceBox.set_origin(startX, startY + searchHeight + spacing); workspaceBox.set_origin(0, startY + searchHeight + spacing);
workspaceBox.set_size( workspaceBox.set_size(
width, width,
Math.round(height * SMALL_WORKSPACE_RATIO)); Math.round(height * SMALL_WORKSPACE_RATIO));
@ -78,19 +77,18 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
return workspaceBox; return workspaceBox;
} }
_getAppDisplayBoxForState(state, workAreaBox, searchHeight, dashHeight, appGridBox) { _getAppDisplayBoxForState(state, box, startY, searchHeight, dashHeight, appGridBox) {
const [startX, startY] = workAreaBox.get_origin(); const [width, height] = box.get_size();
const [width, height] = workAreaBox.get_size();
const appDisplayBox = new Clutter.ActorBox(); const appDisplayBox = new Clutter.ActorBox();
const { spacing } = this; const { spacing } = this;
switch (state) { switch (state) {
case ControlsState.HIDDEN: case ControlsState.HIDDEN:
case ControlsState.WINDOW_PICKER: case ControlsState.WINDOW_PICKER:
appDisplayBox.set_origin(startX, workAreaBox.y2); appDisplayBox.set_origin(0, box.y2);
break; break;
case ControlsState.APP_GRID: case ControlsState.APP_GRID:
appDisplayBox.set_origin(startX, appDisplayBox.set_origin(0,
startY + searchHeight + spacing + appGridBox.get_height()); startY + searchHeight + spacing + appGridBox.get_height());
break; break;
} }
@ -128,37 +126,33 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
return [0, 0]; return [0, 0];
} }
vfunc_allocate(_container, _box) { vfunc_allocate(container, box) {
const childBox = new Clutter.ActorBox(); const childBox = new Clutter.ActorBox();
const { spacing } = this; const { spacing } = this;
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(); box.y1 += startY;
workAreaBox.set_origin(startX, startY); const [width, height] = box.get_size();
workAreaBox.set_size(workArea.width, workArea.height);
const [width, height] = workAreaBox.get_size();
let availableHeight = height; let availableHeight = height;
const availableWidth = width;
// Search entry // Search entry
let [searchHeight] = this._searchEntry.get_preferred_height(width); let [searchHeight] = this._searchEntry.get_preferred_height(width);
childBox.set_origin(startX, startY); childBox.set_origin(0, startY);
childBox.set_size(width, searchHeight); childBox.set_size(width, searchHeight);
this._searchEntry.allocate(childBox); this._searchEntry.allocate(childBox);
availableHeight -= searchHeight + spacing; availableHeight -= searchHeight + spacing;
// Dash // Dash
const maxDashHeight = Math.round(workAreaBox.get_height() * DASH_MAX_HEIGHT_RATIO); const maxDashHeight = Math.round(box.get_height() * DASH_MAX_HEIGHT_RATIO);
this._dash.setMaxSize(width, maxDashHeight); this._dash.setMaxSize(width, maxDashHeight);
let [, dashHeight] = this._dash.get_preferred_height(width); let [, dashHeight] = this._dash.get_preferred_height(width);
dashHeight = Math.min(dashHeight, maxDashHeight); dashHeight = Math.min(dashHeight, maxDashHeight);
childBox.set_origin(startX, startY + height - dashHeight); childBox.set_origin(0, startY + height - dashHeight);
childBox.set_size(width, dashHeight); childBox.set_size(width, dashHeight);
this._dash.allocate(childBox); this._dash.allocate(childBox);
@ -173,13 +167,13 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
thumbnailsHeight = Math.min( thumbnailsHeight = Math.min(
thumbnailsHeight * expandFraction, thumbnailsHeight * expandFraction,
height * WorkspaceThumbnail.MAX_THUMBNAIL_SCALE); height * WorkspaceThumbnail.MAX_THUMBNAIL_SCALE);
childBox.set_origin(startX, startY + searchHeight + spacing); childBox.set_origin(0, startY + searchHeight + spacing);
childBox.set_size(width, thumbnailsHeight); childBox.set_size(width, thumbnailsHeight);
this._workspacesThumbnails.allocate(childBox); this._workspacesThumbnails.allocate(childBox);
} }
// Workspaces // Workspaces
let params = [workAreaBox, searchHeight, dashHeight, thumbnailsHeight]; let params = [box, startY, searchHeight, dashHeight, thumbnailsHeight];
const transitionParams = this._stateAdjustment.getStateTransitionParams(); const transitionParams = this._stateAdjustment.getStateTransitionParams();
// Update cached boxes // Update cached boxes
@ -204,7 +198,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
const workspaceAppGridBox = const workspaceAppGridBox =
this._cachedWorkspaceBoxes.get(ControlsState.APP_GRID); this._cachedWorkspaceBoxes.get(ControlsState.APP_GRID);
params = [workAreaBox, searchHeight, dashHeight, workspaceAppGridBox]; params = [box, startY, searchHeight, dashHeight, workspaceAppGridBox];
let appDisplayBox; let appDisplayBox;
if (!transitionParams.transitioning) { if (!transitionParams.transitioning) {
appDisplayBox = appDisplayBox =
@ -222,8 +216,8 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
} }
// Search // Search
childBox.set_origin(startX, startY + searchHeight + spacing); childBox.set_origin(0, startY + searchHeight + spacing);
childBox.set_size(availableWidth, availableHeight); childBox.set_size(width, availableHeight);
this._searchController.allocate(childBox); this._searchController.allocate(childBox);