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

+21 -10
View File
@@ -4,6 +4,7 @@ import { dimPlanes, type Plane } from "../graphics/plane";
import { spanCurrent } from "../native/frame-timings";
import { type ConfigSettingBoolean, type ConfigSettingString, type VoiceProvider } from "./dashboard-settings";
import { directionalFallback, isDirectionalInput, type InputEvent } from "./gestures";
import { toViewport, type Viewport, type ViewportSize } from "./viewport";
export type TextSettingsEditToggle = {
setting: ConfigSettingBoolean;
@@ -155,18 +156,19 @@ export class LayerStack {
private readonly shellKeys = new WeakMap<Layer, number>();
private readonly ctx: LayerContext;
/**
* The base viewport's size, or null to follow the paired glasses' screen
* as it is now: the shell's own stack lives for the whole process, and
* The base viewport, or null to follow the paired glasses' screen as it
* is now: the shell's own stack lives for the whole process, and
* re-pairing with the other glasses type changes the screen under it.
*/
private baseSize: { width: number; height: number } | null;
private baseSize: Viewport | null;
private readonly focusedFn: () => boolean;
private lastBaseDim: number | false = 1;
constructor(
baseLayer: Layer,
actions: LayerActions,
baseSize?: { width: number; height: number },
// A bare size is a viewport nothing borders (see toViewport).
baseSize?: ViewportSize | Viewport,
// Whether this stack is the current input target; drives the strength of
// selection highlights (a visible-but-unfocused window dims its selection).
// Defaults to always-focused for shell overlays and standalone stacks.
@@ -177,7 +179,7 @@ export class LayerStack {
stack: this,
actions,
};
this.baseSize = baseSize ? { width: baseSize.width, height: baseSize.height } : null;
this.baseSize = baseSize ? toViewport(baseSize) : null;
this.focusedFn = isFocused;
}
@@ -247,13 +249,22 @@ export class LayerStack {
return this.layers.length === 1;
}
getBaseSize(): { width: number; height: number } {
return this.baseSize ? { ...this.baseSize } : { width: screenWidth(), height: screenHeight() };
/**
* The viewport layers lay out in: its size, what each of its edges
* touches, and the padding suggested for them (see viewport.ts). A host
* that gave only a size, and the shell's own screen-sized stack, have
* edges nothing borders and no padding.
*/
getBaseSize(): Viewport {
return toViewport(this.baseSize ?? { width: screenWidth(), height: screenHeight() });
}
/** Resize the base viewport (e.g. an EvenHub window switching to the tall canvas). */
setBaseSize(size: { width: number; height: number }): void {
this.baseSize = { width: size.width, height: size.height };
/**
* Resize the base viewport (e.g. an EvenHub window switching to the tall
* canvas), or change what its edges touch.
*/
setBaseSize(size: ViewportSize | Viewport): void {
this.baseSize = toViewport(size);
}
setActions(actions: Partial<LayerActions>): void {