API Reference

class A11yNode

One frame's accessibility projection of a semantic node.

init(nodeId: Int, nodeParent: Int, nodeRole: String, nodeRoleId: Int, nodeName: String, nodeValue: String, bx: Int, by: Int, bw: Int, bh: Int, mask: Int, isChecked: Bool, isDisabled: Bool, isFocused: Bool, isInert: Bool, isSelected: Bool, expandedValue: Int, isBusy: Bool, isRequired: Bool, invalidValue: Int, levelValue: Int, liveValue: Int, nodeDescription: String, minValue: Float, maxValue: Float, stepValue: Float, labelValue: Int, describedByValue: Int, controlsValue: Int, announceValue: Int)

fields

  • actions: Int
  • announceSeq: Int
  • busy: Bool
  • checked: Bool
  • controlsId: Int
  • describedById: Int
  • description: String
  • disabled: Bool
  • expanded: Int
  • focused: Bool
  • h: Int
  • id: Int
  • inert: Bool
  • invalid: Int
  • labelId: Int
  • level: Int
  • live: Int
  • name: String
  • parent: Int
  • required: Bool
  • role: String
  • roleId: Int
  • selected: Bool
  • value: String
  • valueMax: Float
  • valueMin: Float
  • valueStep: Float
  • w: Int
  • x: Int
  • y: Int
fn can(a: String): Bool
fn describe(): String
class A11yRange

Bounds and step of a numeric control, as reported by Driver.rangeOf.

init(low: Float, high: Float, by: Float)

fields

  • max: Float
  • min: Float
  • step: Float
class Accessibility

The accessibility view of one frame, built from the semantic tree.

fields

fn at(i: Int): A11yNode
fn count(): Int
fn dump(): String
fn encode(): ByteBuffer

Encode the projection as the host accessibility packet.

fn find(role: String, name: String): Int
fn increment(t: Tree, id: Int, delta: Float): Bool
fn press(t: Tree, id: Int): Bool
fn setValue(t: Tree, id: Int, s: String): Bool
class App

init(w: Window, th: Theme, v: fn(Build): Node)

fields

  • animatingFlag: Bool
  • announcePriorityV: Int
  • announceSeqV: Int
  • announceTextV: String
  • cameraOn: Bool
  • cameraV: Camera
  • clipboard: String
  • clipboardGen: Int
  • clipboardStale: Bool
  • closeRequested: Bool
  • colorV: Int
  • damageOverlay: Bool
  • deferCommit: Bool
  • eventWindow: Int
  • explicitAnimating: Bool
  • extraWindows: Int
  • fakeNowV: Int
  • fixedFrameNsV: Int
  • forceFull: Bool
  • frameClock: FrameClock
  • frames: Int
  • gamepadHandler: fn(Gamepad): Void
  • hostAddr: Int
  • hostFrameHook: fn(Int): Void
  • hostGenerationSeen: Int
  • imeFocused: Int
  • inspectorEnvRead: Bool
  • inspectorNodeV: Int
  • inspectorOn: Bool
  • lastH: Int
  • lastStatsV: String
  • lastTimelineV: String
  • lastW: Int
  • linkHandler: fn(String): Void
  • linkHandlerSet: Bool
  • modifiers: Int
  • pad: Gamepad
  • pointerMode: Int
  • pointerX: Int
  • pointerY: Int
  • reactiveV: Reactive?
  • rendererChoice: Renderer
  • resumeAnimating: Bool
  • rootTree: Tree
  • scaleV: Int
  • shortcuts: Shortcuts
  • status: Int
  • surfaceSocket: String
  • suspended: Bool
  • textEngine: TextEngine
  • textInput: Bool
  • theme: Theme
  • themeRevV: Int
  • view: fn(Build): Node
  • window: Window
fn accessibility(): Accessibility

The accessibility projection of the current tree, plus any announcement.

fn accessibilityTree(): Accessibility

The accessibility projection of the tree alone, without announcements.

fn advance(dtNs: Int): Frame

Advance the virtual clock by dtNs and build one frame. Headless tests use this so animation state depends on the step count, not wall time.

fn animating(): Bool
fn announce(text: String, priority: Int)

Announce a transient message to assistive technology. Priority 1 is polite and priority 2 is assertive. The message replaces the previous announcement and advances the sequence, so repeated calls do not stack.

fn bind(chord: String, run: fn(): Void)

Bind a named chord such as ctrl+s or f1.

fn bindReactive(rx: Reactive)

Bind the reactive graph the view reads. The app drains its queued effects at the start of a frame and folds its frame intent into setAnimating. One graph per app; none is created for you.

fn camera(): Camera
fn capture(path: String): Bool

Write the last presented frame as a PNG. Uses the host surface in a window.

fn clearCamera()
fn clipboardText(): String

The current clipboard text. Reads the host selection lazily.

fn clock(): FrameClock

Time source for the view. Ticked once per frame by App.frame.

fn colorSpace(): Int
fn confinePointer()

Keep pointer motion inside the window.

fn copy(): Bool

Copy the focused text box's selection into the system clipboard.

fn cut(): Bool

Cut the focused text box's selection.

fn draw(f: Frame): Surface

Render an encoded frame into a new surface.

fn eventWindowId(): Int

The window that produced the last host event.

fn focusNext(): Int
fn frame(): Frame
fn gamepad(): Gamepad
fn inspector(): Bool
fn isSuspended(): Bool
fn keyDown(k: Key): Bool

Route a key to the focused node, focusing the first control if none is.

fn lastStats(): String

Build the tree, lay it out, and encode a full frame.

fn lastStatus(): Int
fn lastTimeline(): String

Phase timings of the last built frame, in integer microseconds.

fn lockPointer()

Lock the pointer to its current position.

fn measureStyledText(s: String, size: Float, weight: Int, italic: Bool, tracking: Float): Float

Width of one unwrapped line with weight, italic, and tracking applied.

fn measureText(s: String, size: Float): Float

Width of one unwrapped line, using the app's shaping engine.

fn onGamepad(handler: fn(Gamepad): Void)

Observe normalized gamepad axis and button changes.

fn onHostFrame(handler: fn(Int): Void)

Run after every host frame with the frame index, for automation and tracing.

fn onLink(h: fn(String): Void)

Observe completed link clicks from any text node.

fn openLink(url: String): Bool

Run the link handler for url. False for an empty URL or no handler.

fn openWindow(title: String, w: Int, h: Int): Int

Open another toplevel; returns its window id or a negative status.

fn paste(): Bool

Paste the system clipboard into the focused text box.

fn pointerDown(x: Int, y: Int): Bool
fn pointerLeave(): Bool
fn pointerMove(x: Int, y: Int): Bool
fn pointerUp(x: Int, y: Int): Bool
fn presentWindow(id: Int, f: Frame): Int

Present one frame to a specific toplevel.

fn quit()

Ask the live host loop to close the window after the current frame.

fn releasePointer()
fn renderer(): Renderer
fn resume()

Resume drawing and restore the previous animation request.

fn runScript(script: String): Int

Run a semicolon-separated UI script headless. Returns 0 when every step passes.

fn scale(): Int
fn screenshot(path: String): Bool

Render the current frame and write it as a PNG.

fn screenshotBytes(): ByteBuffer

Render the current frame on the CPU and return a PNG.

fn scrollAt(x: Int, y: Int, dy: Float): Bool
fn sendKey(code: Int, down: Bool)

Feed an evdev key code. Tests and automation use this instead of a window.

fn setAnimating(on: Bool)

Ask for continuous frames. While animating, the window draws as fast as the compositor accepts frames. While paused, it draws once per input event and sleeps otherwise, and the frame clock stops advancing.

fn setCamera(c: Camera)

Apply a scene camera to presentation and hit testing.

fn setClipboard(s: String)
fn setColorSpace(c: Int)

Color space wire id: 0 sRGB, 1 linear, 2 Display P3.

fn setDamageOverlay(on: Bool)

Outline changed regions, like the show-surface-updates developer flag.

fn setDpi(d: Float)

Device pixel ratio: tags the frame and exposes Tree.dp to the view.

fn setFixedFrameNs(ns: Int)

Use a fixed frame step instead of the real clock, for tests and captures.

fn setInspector(on: Bool)

Draw node outlines and role labels over the frame for devtools.

fn setInspectorNode(id: Int)

Tint and thicken one node's outline. Pass -1 to clear the selection.

fn setKeyboardInset(bottom: Int)
fn setRenderer(r: Renderer)

Change the backend before the first GPU call. One backend per process.

fn setSafeArea(top: Int, right: Int, bottom: Int, left: Int)
fn setScale(s: Int)

Output scale in thousandths. 2000 asks for a 2x buffer.

fn setSurfaceSocket(path: String)

Send frames to a surface socket instead of the Wayland window.

fn setTextScale(f: Float)
fn setTheme(th: Theme)

Swap the theme before the next frame and invalidate every cached paint.

fn shortcuts(): Shortcuts
fn show(): Int

Open the window and render until it closes.

fn showFor(frames: Int): Int

Open the window, render frames frames, then close. For smoke tests.

fn suspend()

Stop drawing and pause the frame clock, as a hidden surface does.

fn themeRevision(): Int

Integer theme revision; increments on every setTheme.

fn tick(): Surface

Encode one frame and render it into a new surface.

fn touchCancel(id: Int): Bool

Cancel one host touch id.

fn touchDown(id: Int, x: Int, y: Int): Bool

Press one host touch id at screen coordinates.

fn touchMove(id: Int, x: Int, y: Int): Bool

Move one host touch id.

fn touchUp(id: Int, x: Int, y: Int): Bool

Release one host touch id.

fn tree(): Tree
fn windowCount(): Int
fn windowGeneration(id: Int): Int
fn windowHeight(id: Int): Int
fn windowWidth(id: Int): Int
class AppBundle

The packaging manifest for an app bundle.

init(name: String, version: String, entry: String, capabilities: Array<String>)

fields

  • capabilities: Array<String>
  • entry: String
  • name: String
  • version: String
fn manifest(): String
fn writeTo(path: String): Bool

Write the manifest to an exact path.

class AppConfig

Static app description, separate from the running window.

init(title: String, width: Int, height: Int, appearance: Appearance, entry: String)

fields

  • appearance: Appearance
  • entry: String
  • height: Int
  • title: String
  • width: Int
fn heightValue(): Int
fn theme(systemDark: Bool): Theme

Resolve the appearance against a desktop preference.

fn titleText(): String
fn widthValue(): Int
class AppFiles

File helpers for app code. Paths are passed through untouched.

fn exists(path: String): Bool
fn join(dir: String, name: String): String
fn readText(path: String): String
fn writeText(path: String, text: String): Bool
class Driver

Test-driver API over the accessibility projection.

init(a: App)

fields

  • app: App
  • pinchRotationV: Float
  • pinchValueV: Float
fn access(): Accessibility
fn announce(text: String, priority: Int)

Announce a transient message; priority 1 is polite, 2 assertive.

fn busyOf(role: String, name: String): Bool

Whether the named node is busy.

fn checked(role: String, name: String): Bool

The checked state of the named toggle, checkbox, or radio.

fn click(role: String, name: String): Bool
fn descriptionOf(role: String, name: String): String

The accessible description of the named node.

fn doubleTap(role: String, name: String): Bool

Two quick presses on the center of the named node. Returns true when the tree counted the pair as a double tap.

fn drag(role: String, name: String, dx: Float, dy: Float, steps: Int): Bool

Press the center of the named node, move to dx/dy in timed steps, and release. Returns true when the press hit a node.

fn dragTo(sourceRole: String, sourceName: String, targetRole: String, targetName: String, steps: Int): Bool

Press the center of the source, move to the center of the target in timed steps, and release. Returns true only when a drop occurred.

fn dump(): String
fn encode(): ByteBuffer

Encode the projection, including announcements, as the host packet.

fn exists(role: String, name: String): Bool
fn expandedOf(role: String, name: String): Int

Expansion state of the named node: -1 unknown, 0 collapsed, 1 expanded.

fn fling(role: String, name: String, velocity: Float): Bool

Start a fling on the scroll node containing the named node.

fn focus(role: String, name: String): Bool
fn frame()
fn increment(role: String, name: String, delta: Float): Bool
fn inspect(on: Bool)

Toggle the node inspector overlay.

fn key(role: String, name: String, key: Key): Bool

Route a key to the named node after focusing it.

fn longPress(role: String, name: String): Bool

Hold the center of the named node for about 0.55 s, then release. Returns true when both the press and the release reached a node.

fn openLink(name: String): Bool

Open the link node with accessible name name.

fn openLinkUrl(url: String): Bool

Open url through the app link handler.

fn pinch(role: String, name: String, scale: Float): Bool

Put two pointers on either side of the named node's center and move them until the distance ratio reaches scale. The pre-release ratio stays readable through pinchValue and pinchRotationValue.

fn pinchRotation(): Float

Alias for pinchRotationValue that matches the tree query.

fn pinchRotationValue(): Float

The rotation in radians measured before the last driver pinch released.

fn pinchScale(): Float

Alias for pinchValue that matches the tree query.

fn pinchValue(): Float

The pinch ratio measured just before the last driver pinch released.

fn press(role: String, name: String): Bool
fn rangeOf(role: String, name: String): A11yRange

Bounds and step of the named numeric control.

fn runScript(script: String): Int

Run a semicolon-separated script of UI steps. Steps that change state build a frame before the next step so assertions see current state.

fn screenshot(path: String): Bool

Render the current frame and write it as a PNG.

fn scroll(role: String, name: String, dy: Float): Bool

Scroll at the center of the named node.

fn selectedOf(role: String, name: String): Bool

Whether the named node is selected.

fn setValue(role: String, name: String, value: String): Bool
fn stats(): String

Counts from the last built frame.

fn timeline(): String

Phase timings of the last built frame, in integer microseconds.

fn tree(): Tree
fn value(role: String, name: String): String
fn valueOf(role: String, name: String): String

The current value of the named text box or slider.

class Frame

One encoded frame: the display list plus the semantic snapshot that made it.

init(index: Int, list: ByteBuffer, snapshot: String, damageList: Damage, packetBuf: ByteBuffer, scaleV: Int, colorV: Int, dropped: Int, buildTime: Int, layoutTime: Int, paintTime: Int, totalTime: Int)

fields

  • buildNs: Int
  • byteCountV: Int
  • colorV: Int
  • damageList: Damage
  • droppedV: Int
  • index: Int
  • layoutNs: Int
  • list: ByteBuffer
  • nodeCountV: Int
  • packetBuf: ByteBuffer
  • paintNs: Int
  • recordCountV: Int
  • scaleV: Int
  • snapshot: String
  • totalNs: Int
fn bytes(): Int
fn colorSpace(): Int

Color space wire id: 0 sRGB, 1 linear, 2 Display P3.

fn damage(): Damage
fn describe(): String

The display list in text form, for tests and the inspector.

fn dropped(): Int

Records the display list refused because its 1024-record budget filled.

fn nodes(): FramePacket

Decoded packet, for hosts and tests.

fn packet(): ByteBuffer

The node layout and semantics packet for this frame.

fn records(): Int
fn scale(): Int

Output scale in thousandths: 1000 is 1x, 2000 is 2x.

fn stats(): String

One-line frame summary for devtools and AI tests.

fn timeline(): String

Per-frame phase timings in integer microseconds.

class Gamepad

Normalized gamepad state. Axes are -1..1; buttons are pressed.

fields

  • axes: Array<Float>
  • buttons: Array<Bool>
  • online: Bool
fn axis(i: Int): Float
fn connected(): Bool
fn pressed(i: Int): Bool
fn reset()
fn setAxis(i: Int, raw: Int)
fn setButton(i: Int, down: Bool)
fn setConnected(on: Bool)
class Mcp

MCP tool projection over a Driver. Off unless an app builds it.

init(d: Driver)

fields

fn call(tool: String, role: String, name: String, value: String, delta: Float): String
fn tools(): String
class Notice

One transient message.

init(id: Int, title: String, body: String)

fields

  • body: String
  • id: Int
  • title: String
class Notifications

App-local notification queue.

fields

  • items: Array<Notice>
  • nextId: Int
fn at(i: Int): Notice
fn body(i: Int): String
fn clear()
fn count(): Int
fn dismiss(id: Int): Bool
fn post(title: String, body: String): Int
fn title(i: Int): String
fn view(b: Build): Node

Build a toast stack for the current queue.

class Route

A route pattern relative to its parent, plus its own children.

init(pattern: String, build: fn(RouteMatch): View, children: Array<Route>)

fields

class RouteMatch

One level of a resolved nested route. The route build receives it, reads params(), and places outlet() where the child view belongs.

init(fullPath: String, paramMap: Map<String, String>, rest: Array<String>, children: Array<Route>, build: fn(RouteMatch): View, matched: Bool)

fields

  • buildV: fn(RouteMatch): View
  • childrenV: Array<Route>
  • fullPathV: String
  • matchedV: Bool
  • paramMapV: Map<String, String>
  • restV: Array<String>
fn matched(): Bool
fn outlet(): View

The child view for the remaining path, or a not-found page.

fn params(): Map<String, String>

Merged parent and child params plus the parsed query string.

fn path(): String

The full requested path, query string included.

class Router

A route table with a back stack.

fields

  • builders: Array<fn(): Node>
  • current: String
  • paths: Array<String>
  • stack: Array<String>
fn back(): Bool
fn currentPath(): String
fn depth(): Int
fn has(path: String): Bool
fn navigate(path: String): Bool
fn replace(path: String): Bool
fn route(path: String, view: fn(): Node): Router
fn view(): Node
class Surface

init(width: Int, height: Int, list: ByteBuffer)

fields

  • height: Int
  • list: ByteBuffer
  • pixels: ByteBuffer
  • usedBackend: Int
  • width: Int
fn backend(): Int

1 after a GPU draw, 2 after a CPU draw, 0 before any draw.

fn describe(): String

The display list in text form, for tests and the inspector.

fn draw(): Int

Render on the GPU, falling back to the CPU when no device answers.

fn drawCpu(): Int

Force the CPU renderer. Zero on success.

fn encodePng(): ByteBuffer

Encode the pixels as a PNG.

fn pendingImages(): Int

Number of images still decoding on the CPU worker.

fn pixel(x: Int, y: Int): Int

One pixel as 0xRRGGBBAA.

fn pixels(): ByteBuffer

Raw RGBA8 pixels, row-major. For dumps and tests.

fn records(): Int
fn rgbaAt(x: Int, y: Int): String
fn waitImages(timeoutMs: Int): Int

Wait for CPU image decodes, returning the remaining count.

fn writePng(path: String): Bool

Write the frame as a PNG.

class ViewRouter

A route table over declarative View values. Patterns hold exact segments, :name parameters, and a final * wildcard. Each router owns its route list and history stack. A nested root adds parent layouts and outlets while the flat route surface keeps working.

fields

  • builders: Array<fn(Map<String, String>): View>
  • current: String
  • lastKey: String
  • lastPath: String
  • lastView: View?
  • navSeq: Int
  • nestedRootV: Route?
  • patterns: Array<String>
  • previousKey: String
  • previousView: View?
  • stack: Array<String>
  • transitionV: Transition?
fn back(): Bool
fn currentPath(): String
fn depth(): Int
fn navigate(path: String): Bool
fn nested(root: Route): ViewRouter

Attach a nested root. Flat route entries stay in place.

fn params(): Map<String, String>
fn replace(path: String): Bool
fn resolve(path: String): View
fn route(pattern: String, build: fn(Map<String, String>): View): ViewRouter
fn view(): View
fn withTransition(t: Transition): ViewRouter

Cross-fade a path change with t. The outgoing view stays mounted under its old key while it fades out, and the incoming view fades in over it. Once the fade reaches zero the outgoing view becomes a zero-height placeholder until the next path change replaces it.

class Window

The app's one window. On runixOS, the surface socket owns the surface, not the app.

init(title: String, width: Int, height: Int)

fields

  • height: Int
  • title: String
  • width: Int
class WindowSet

An app: a window, a theme, and a view function. The view runs again on every frame, because the MVP tree is append-only and reconciliation is not here yet.

Per-window state for an app that owns more than one surface.

fields

  • focusId: Int
  • frames: Array<Int>
  • heights: Array<Int>
  • ids: Array<Int>
  • nextId: Int
  • paused: Array<Bool>
  • titles: Array<String>
  • visible: Array<Bool>
  • widths: Array<Int>
fn close(id: Int): Bool
fn count(): Int
fn focus(id: Int): Bool
fn focused(): Int
fn frame(id: Int): Bool

Count a frame only when the window can draw.

fn framesOf(id: Int): Int
fn heightOf(id: Int): Int
fn isOpen(id: Int): Bool
fn open(title: String, w: Int, h: Int): Int
fn resize(id: Int, w: Int, h: Int): Bool
fn resume(id: Int): Bool
fn route(id: Int): Bool
fn setVisible(id: Int, on: Bool): Bool
fn suspend(id: Int): Bool
fn suspendedAt(id: Int): Bool
fn titleOf(id: Int): String
fn visibleAt(id: Int): Bool
fn widthOf(id: Int): Int
class Worker

A worker thread with a typed result.

init(handle: Thread)

fields

  • handle: Thread
fn join(): Int
enum Appearance
  • dark
  • light
  • system
enum Renderer
  • auto
  • gles
  • vulkan

Functions

fn abiVersion(): Int
fn measureText(s: String, size: Float): Float

Width of shaped text at size, in device pixels.

fn rendererVersion(): Int