Borderless modes have different padding inside the builtin apps

Most of the builtin apps had some padding between the window edge and
their content, because they expect to be displayed with a line border on
their edge. We added a customization option to remove the border, so,
that padding is not always necessary. Make the layouts dynamically
adjust, to omit the padding when it isn't needed.
This commit is contained in:
James Babcock committed 2026-11-11 15:19:29 -08:00
1 parent e158452ba4
commit a02b849200
115 files changed
+3600 -1583

No files matched your search

+8 -4
View File
@@ -3,6 +3,7 @@ import { flattenPlanes } from "../../graphics/plane";
import { InputEvent } from "../gestures";
import { Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
import { appViewportRect, appViewportSize, SHELL_OPAQUE_BLACK } from "./geometry";
import { uniformEdges, type Viewport, viewportWith } from "../viewport";
// The modal covers most of the min-height app viewport, leaving a little of
// the foreground app visible around the edges. Both its size and position are
@@ -11,13 +12,16 @@ import { appViewportRect, appViewportSize, SHELL_OPAQUE_BLACK } from "./geometry
const MODAL_MARGIN = 14;
const MODAL_PADDING = 4;
/** Content (inner layer stack) size of the modal box. */
function modalInterior(): { width: number; height: number } {
/**
* The modal box's content (inner layer stack) viewport: every edge is just
* inside the box's border.
*/
function modalInterior(): Viewport {
const viewport = appViewportSize("min");
return {
return viewportWith({
width: viewport.width - 2 * MODAL_MARGIN - 2 * MODAL_PADDING,
height: Math.min(viewport.height - 2 * MODAL_MARGIN, Math.floor(65530 / Math.ceil((viewport.width - 2 * MODAL_MARGIN) / 2))) - 2 * MODAL_PADDING,
};
}, uniformEdges("border"));
}
/** Screen rect of the modal box, aligned to the min-height window band. */