overview: Get rid of panel ghost actor
Right now we use a ClutterClone ghost of the panel simply to add some spacing to the top monitor edge. We can remove the panelGhost by adjusting the allocations of all the parts of the overview ourselves inside ControlsManagers vfunc_allocate, this should also work with extensions that move the panel somewhere else. This makes the initial relayout of the overview significantly faster, because we now no longer have to relayout the whole panel in the process. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1755>
This commit is contained in:
parent
ae23ad372d
commit
d49606bbaa
@ -85,16 +85,6 @@ class OverviewActor extends St.BoxLayout {
|
|||||||
|
|
||||||
this.add_constraint(new LayoutManager.MonitorConstraint({ primary: true }));
|
this.add_constraint(new LayoutManager.MonitorConstraint({ primary: true }));
|
||||||
|
|
||||||
// Add a clone of the panel to the overview so spacing and such is
|
|
||||||
// automatic
|
|
||||||
let panelGhost = new St.Bin({
|
|
||||||
child: new Clutter.Clone({ source: Main.panel }),
|
|
||||||
reactive: false,
|
|
||||||
opacity: 0,
|
|
||||||
});
|
|
||||||
this.add_actor(panelGhost);
|
|
||||||
|
|
||||||
|
|
||||||
this._controls = new OverviewControls.ControlsManager();
|
this._controls = new OverviewControls.ControlsManager();
|
||||||
this.add_child(this._controls);
|
this.add_child(this._controls);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
stateAdjustment.connect('notify::value', () => this.layout_changed());
|
stateAdjustment.connect('notify::value', () => this.layout_changed());
|
||||||
}
|
}
|
||||||
|
|
||||||
_computeWorkspacesBoxForState(state, box, searchHeight, dashHeight, thumbnailsHeight) {
|
_computeWorkspacesBoxForState(state, box, startY, searchHeight, dashHeight, thumbnailsHeight) {
|
||||||
const workspaceBox = box.copy();
|
const workspaceBox = box.copy();
|
||||||
const [width, height] = workspaceBox.get_size();
|
const [width, height] = workspaceBox.get_size();
|
||||||
const { spacing } = this;
|
const { spacing } = this;
|
||||||
@ -58,7 +58,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
break;
|
break;
|
||||||
case ControlsState.WINDOW_PICKER:
|
case ControlsState.WINDOW_PICKER:
|
||||||
workspaceBox.set_origin(0,
|
workspaceBox.set_origin(0,
|
||||||
searchHeight + spacing +
|
startY + searchHeight + spacing +
|
||||||
thumbnailsHeight + spacing * expandFraction);
|
thumbnailsHeight + spacing * expandFraction);
|
||||||
workspaceBox.set_size(width,
|
workspaceBox.set_size(width,
|
||||||
height -
|
height -
|
||||||
@ -67,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(0, 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));
|
||||||
@ -77,7 +77,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
return workspaceBox;
|
return workspaceBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
_getAppDisplayBoxForState(state, box, searchHeight, dashHeight, appGridBox) {
|
_getAppDisplayBoxForState(state, box, startY, searchHeight, dashHeight, appGridBox) {
|
||||||
const [width, height] = box.get_size();
|
const [width, height] = box.get_size();
|
||||||
const appDisplayBox = new Clutter.ActorBox();
|
const appDisplayBox = new Clutter.ActorBox();
|
||||||
const { spacing } = this;
|
const { spacing } = this;
|
||||||
@ -89,7 +89,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
break;
|
break;
|
||||||
case ControlsState.APP_GRID:
|
case ControlsState.APP_GRID:
|
||||||
appDisplayBox.set_origin(0,
|
appDisplayBox.set_origin(0,
|
||||||
searchHeight + spacing + appGridBox.get_height());
|
startY + searchHeight + spacing + appGridBox.get_height());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,12 +130,17 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
|
|
||||||
const { spacing } = this;
|
const { spacing } = this;
|
||||||
|
|
||||||
|
let startY = 0;
|
||||||
|
if (Main.layoutManager.panelBox.y === Main.layoutManager.primaryMonitor.y) {
|
||||||
|
startY = Main.layoutManager.panelBox.height;
|
||||||
|
box.y1 += startY;
|
||||||
|
}
|
||||||
const [width, height] = box.get_size();
|
const [width, height] = box.get_size();
|
||||||
let availableHeight = height;
|
let availableHeight = height;
|
||||||
|
|
||||||
// Search entry
|
// Search entry
|
||||||
const [searchHeight] = this._searchEntry.get_preferred_height(width);
|
let [searchHeight] = this._searchEntry.get_preferred_height(width);
|
||||||
childBox.set_origin(0, 0);
|
childBox.set_origin(0, startY);
|
||||||
childBox.set_size(width, searchHeight);
|
childBox.set_size(width, searchHeight);
|
||||||
this._searchEntry.allocate(childBox);
|
this._searchEntry.allocate(childBox);
|
||||||
|
|
||||||
@ -147,7 +152,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
|
|
||||||
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(0, 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);
|
||||||
|
|
||||||
@ -162,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(0, 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 = [box, 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
|
||||||
@ -193,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 = [box, searchHeight, dashHeight, workspaceAppGridBox];
|
params = [box, startY, searchHeight, dashHeight, workspaceAppGridBox];
|
||||||
let appDisplayBox;
|
let appDisplayBox;
|
||||||
if (!transitionParams.transitioning) {
|
if (!transitionParams.transitioning) {
|
||||||
appDisplayBox =
|
appDisplayBox =
|
||||||
@ -211,7 +216,7 @@ class ControlsManagerLayout extends Clutter.BoxLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
childBox.set_origin(0, searchHeight + spacing);
|
childBox.set_origin(0, startY + searchHeight + spacing);
|
||||||
childBox.set_size(width, availableHeight);
|
childBox.set_size(width, availableHeight);
|
||||||
|
|
||||||
this._searchController.allocate(childBox);
|
this._searchController.allocate(childBox);
|
||||||
|
Loading…
Reference in New Issue
Block a user