imzhost

package
v0.0.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package imzhost provides reusable imzero2 host-side helpers shared by the carousel demo and elle's cmd host: the shared window chrome (DecorateRenderer / ChromeConfig), the per-app windowed renderer adapter (AdaptToRenderer / WindowDefaultSize), and the screenshot-tour renderers (AdaptBodyOnly / DecorateScreenshotRenderer / ScreenshotStageSize).

These were extracted from the carousel and elle hosts so both drive the same chrome and adapter code rather than maintaining divergent copies.

Index

Constants

This section is empty.

Variables

View Source
var PackageProps = packageprops.Props{
	WASMWASI:         packageprops.WASMBlocked,
	WASMJS:           packageprops.WASMBlocked,
	WASMFreestanding: packageprops.WASMBlocked,
}

PackageProps records this package's curated properties (ADR-0080). Seeded by `wasmsurvey props generate`; curate by hand, then `wasmsurvey props verify`.

Functions

func AdaptBodyOnly

func AdaptBodyOnly(a app.AppI) func(hids *c.WidgetIdStack) error

AdaptBodyOnly wraps an app's body without Window chrome. Used in screenshot mode so the app renders directly into the host Frame (no title bar, no resize handles) for clean capture output.

func AdaptToRenderer

func AdaptToRenderer(a app.AppI) (r func() error)

AdaptToRenderer wraps an AppI as a func() error usable by the host's existing renderer slice. Mount runs lazily on the first call. Per ADR-0026 Amendment 2026-05-12, for `SurfaceWindowed` apps the runtime — not the app — creates the window: `a.Frame` is invoked inside a `c.Window` scope built from `Manifest.WindowTitle()` and `SurfaceHints.PreferredWidth/Height`. `SurfaceHeadless` apps still call `Frame` raw. The M3 dock host will replace this adapter with a tile-bound child UI per app.

func DecorateRenderer

func DecorateRenderer(inner func() error, cc ChromeConfig) func() error

DecorateRenderer wraps an inner renderer in the shared host chrome: top PanelTop with the File / Layout menus + an optional ExtraMenus callback (used by the dock host to inject its "Apps" menu), bottom PanelBottom with a runtime status line + the metrics overlay. cc.ExtraMenus may be nil — the screenshot tour path uses nil since there is no WindowHost in tour mode. cc.Status may be nil — the bottom row collapses to the metrics overlay alone. cc.Host may be nil — the status segments stay non-clickable when no windowhost is available to open the capinspector.

func DecorateScreenshotRenderer

func DecorateScreenshotRenderer(bodyRenderers []func(hids *c.WidgetIdStack) error, stageW, stageH float32) func() error

DecorateScreenshotRenderer renders body renderers into AllocateUiAtRect so the content fills a known bounding rect. RequestScreenshotRect captures only that rect — no window chrome, no whitespace.

func ScreenshotStageSize

func ScreenshotStageSize() (w, h float32)

ScreenshotStageSize returns the capture dimensions from the registered imzero2env.ScreenshotSize variable (IMZERO2_SCREENSHOT_SIZE, WxH format, same as boxer's hmi.sh). Falls back to 1600×900 when the env var is empty or malformed — large enough for most UIs.

func WindowDefaultSize

func WindowDefaultSize(h app.SurfaceHints) (w, height float32)

WindowDefaultSize returns the initial Window size for a windowed app. Honours SurfaceHints when set, falls back to a generic large-enough pair that fits most laptop screens without taking the whole viewport.

Types

type ChromeConfig

type ChromeConfig struct {
	// ExtraMenus, when non-nil, is invoked inside the top MenuBar scope
	// after the built-in File / Layout menus (used by the dock host to
	// inject its "Apps" menu). May be nil.
	ExtraMenus func()
	// Status, when non-nil, renders the runtime status line in the bottom
	// panel. May be nil — the bottom row collapses to the metrics overlay
	// alone.
	Status *runtimestatus.Snapshot
	// Host, when non-nil, makes the status segments clickable (opening the
	// capinspector) and is required for HelpHost. May be nil.
	Host *windowhost.Inst
	// VideoOutput renders the ADR-0088 videooutput codec control (carousel:
	// true; elle: false).
	VideoOutput bool
	// HelpHost wires the F1 shortcut to open/focus the HelpHost (carousel:
	// true; elle: false). Requires Host != nil.
	HelpHost bool
}

ChromeConfig configures the shared imzero2 host chrome wrapped around an inner renderer by DecorateRenderer. The zero value renders bare chrome (no extra menus, no status line, no video-output control, no F1 help).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL