workspace: Center window previews horizontally and vertically
Window previews looks slightly offset to the left and top right now because we don't use the same padding on all edges of the Workspace. We do that because the oversize and overlap of the window previews is different on all sides (for example the bottom overlap is very large because there we show the window title). To make sure window previews are always perfectly centered on the Workspace, only use the largest one of the oversize values as spacing and padding, and add the larger one of the overlap values for the vertical padding in addition. With this, we now center the window previews on the Workspace while never overpainting the allocation of that Workspace to show overlays. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3634 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1670>
This commit is contained in:
parent
6f0589313d
commit
dda23fc4c6
@ -467,17 +467,22 @@ var WorkspaceLayout = GObject.registerClass({
|
|||||||
const [topOversize, bottomOversize] = window.chromeHeights();
|
const [topOversize, bottomOversize] = window.chromeHeights();
|
||||||
const [leftOversize, rightOversize] = window.chromeWidths();
|
const [leftOversize, rightOversize] = window.chromeWidths();
|
||||||
|
|
||||||
|
const oversize =
|
||||||
|
Math.max(topOversize, bottomOversize, leftOversize, rightOversize);
|
||||||
|
|
||||||
if (rowSpacing !== null)
|
if (rowSpacing !== null)
|
||||||
rowSpacing += topOversize + bottomOversize;
|
rowSpacing += oversize;
|
||||||
if (colSpacing !== null)
|
if (colSpacing !== null)
|
||||||
colSpacing += Math.max(leftOversize, rightOversize);
|
colSpacing += oversize;
|
||||||
|
|
||||||
if (containerBox) {
|
if (containerBox) {
|
||||||
const [topOverlap, bottomOverlap] = window.overlapHeights();
|
const [topOverlap, bottomOverlap] = window.overlapHeights();
|
||||||
containerBox.x1 += leftOversize;
|
const overlap = Math.max(topOverlap, bottomOverlap);
|
||||||
containerBox.x2 -= rightOversize;
|
|
||||||
containerBox.y1 += topOversize + topOverlap;
|
containerBox.x1 += oversize;
|
||||||
containerBox.y2 -= bottomOversize + bottomOverlap;
|
containerBox.x2 -= oversize;
|
||||||
|
containerBox.y1 += oversize + overlap;
|
||||||
|
containerBox.y2 -= oversize + overlap;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [rowSpacing, colSpacing, containerBox];
|
return [rowSpacing, colSpacing, containerBox];
|
||||||
|
Loading…
Reference in New Issue
Block a user