forked from Blendman974/faceclaw
Unify vertical position and display mode settings; add to onboarding
This commit is contained in:
1 parent
6b1e64c5ac
commit
5a9ca08921
36 files changed
+810
-574
No files matched your search
@@ -8,7 +8,7 @@ import { type MenuItem } from "../menu";
|
||||
import { WindowMenuLayer } from "../window-menu";
|
||||
import { windowIcon } from "./chrome-layer";
|
||||
import { type IconName } from "../../graphics/icons";
|
||||
import { appViewportSize, setAppFullscreen, type WindowHeightMode } from "./geometry";
|
||||
import { appViewportSize, setAppImmersive, type WindowHeightMode } from "./geometry";
|
||||
import { shell, type ShellWindow } from "./shell";
|
||||
|
||||
/**
|
||||
@@ -30,8 +30,8 @@ export type InProcessWindowOptions = {
|
||||
closeable: boolean;
|
||||
/** Window height: the standard 288px band ("min", default) or full screen ("max"). */
|
||||
heightMode?: WindowHeightMode;
|
||||
/** Open fullscreen: the whole panel, without the status bar (see geometry.ts isFullscreen). */
|
||||
fullscreen?: boolean;
|
||||
/** Open immersive: the whole panel, without the status bar (see geometry.ts isImmersive). */
|
||||
immersive?: boolean;
|
||||
/**
|
||||
* The window's tap-then-hold context menu: app-specific entries only (the
|
||||
* shared Focus app switcher / Voice input / Close window entries live in
|
||||
@@ -76,11 +76,11 @@ export type InProcessWindow = {
|
||||
/** Change the window's height band at runtime (resizes the viewport + surface). */
|
||||
setHeightMode: (mode: WindowHeightMode) => void;
|
||||
/**
|
||||
* Enter or leave fullscreen at runtime (resizes the viewport + surface).
|
||||
* It is per app (geometry.ts isFullscreen), so an app with several
|
||||
* Enter or leave immersive mode at runtime (resizes the viewport +
|
||||
* surface). It is per app (geometry.ts isImmersive), so an app with several
|
||||
* windows switches them all.
|
||||
*/
|
||||
setFullscreen: (fullscreen: boolean) => void;
|
||||
setImmersive: (immersive: boolean) => void;
|
||||
};
|
||||
|
||||
/** The controller-provided plumbing common to every in-process app window. */
|
||||
@@ -110,7 +110,7 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
|
||||
// Handed to app code as a bare callback, so it takes no arguments.
|
||||
const requestRender = () => renderInNewFrame(0);
|
||||
let heightMode = options.heightMode ?? "min";
|
||||
setAppFullscreen(options.appId, options.fullscreen ?? false);
|
||||
setAppImmersive(options.appId, options.immersive ?? false);
|
||||
const viewportSize = () => appViewportSize(heightMode, options.appId);
|
||||
const stack = new LayerStack(
|
||||
options.baseLayer,
|
||||
@@ -182,7 +182,7 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
|
||||
hasAppMenu: () => appMenuItems().length > 0,
|
||||
close: () => {
|
||||
closed = true;
|
||||
setAppFullscreen(options.appId, false);
|
||||
setAppImmersive(options.appId, false);
|
||||
// Fire onRemoved for any pushed layers so they release resources (e.g. a
|
||||
// demo that enabled a hardware stream) even when closed from within.
|
||||
stack.clearToBase();
|
||||
@@ -248,10 +248,10 @@ export function createInProcessWindow(options: InProcessWindowOptions): InProces
|
||||
window.heightMode = mode;
|
||||
resize();
|
||||
};
|
||||
const setFullscreen = (fullscreen: boolean) => {
|
||||
if (!closed && setAppFullscreen(options.appId, fullscreen)) resize();
|
||||
const setImmersive = (immersive: boolean) => {
|
||||
if (!closed && setAppImmersive(options.appId, immersive)) resize();
|
||||
};
|
||||
return { window, stack, requestRender, setHeightMode, setFullscreen };
|
||||
return { window, stack, requestRender, setHeightMode, setImmersive };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user