Skip to main content

Crate cranpose_app_shell

Crate cranpose_app_shell 

Source
Expand description

§Cranpose App Shell

cranpose-app-shell coordinates Cranpose composition, frame cadence, input dispatch, focus, layout, and redraw. Platform adapters route window events and display callbacks into UI work. Most app authors use cranpose::AppLauncher; platform, renderer, and test authors use this crate.

§Frame-rate policy

Platform frame drivers can use FrameRatePreference to choose a display vote. Auto uses a quiet rate for ordinary frames and the panel maximum while a gesture boost remains active. Exact requests a fixed rate.

use cranpose_app_shell::FrameRatePreference;

let requested_hz = FrameRatePreference::Exact(90.0)
    .desired_rate_hz(true, false, Some(120.0));
assert_eq!(requested_hz, 90.0);

The shell exposes FrameScheduler, FrameSchedule, PlatformFrameDriver, RootSurface, and input event types for host implementations. clipboard-native enables the desktop clipboard adapter. test-support exposes placed semantics and accessibility audit modules used by cranpose-testing.

Modules§

accessibility_audit
The checks a screen reader user fails a screen on, run over a placed semantics tree so a test catches them before a person does.
inspector
Developer inspection drawn outside the application’s composition and semantics.
placed_semantics
What a screen reader is told, and where each of those things actually is.

Structs§

AppShell
The application: one runtime, one composition, and a surface per window it shows.
DevOptions
Development options for debugging and performance monitoring.
FpsStats
Frame statistics snapshot.
FrameRateBoost
When FrameRatePreference::Auto asks for the display’s fastest rate, following how Android’s views vote a frame-rate category: input, content that moves, and a large view redrawn continuously all vote high. A Cranpose window is one screen-sized view, as a Compose window is, so continuous redraws boost it and intermittent ones, such as a blinking cursor, do not. A boost holds for a few seconds, so the display does not flap between rates.
FrameSchedule
What the shell needs from the platform loop next: an update now, a display frame, or a wake at a later time. The default needs nothing.
FrameScheduler
Stores the latest FrameSchedule of a surface for the platform code that drives it. A surface lives on its shell’s thread, so the schedule sits in a Cell: on ESP-IDF a Mutex is a FreeRTOS mutex, which every frame took.
FrameUpdateResult
What one shell update changed.
ImeEditorState
Snapshot of the focused text field’s editable state for platform IMEs.
KeyEvent
A keyboard input event.
Modifiers
Keyboard modifier keys held during an input sample.
NativeKeyEvent
What the platform reported about a key event beyond the key, as KeyEvent.nativeKeyEvent holds in Compose.
PointerEventTime
Platform and animation-clock timestamps for one pointer sample.
PointerId
Identifies one pointer of a gesture, such as one finger, as Compose’s PointerId. The primary pointer is PointerId::PRIMARY.
RootSurface
The shell’s bookkeeping for one root.
RotaryScrollEvent
A rotary scroll event produced by a Wear OS crown or rotating bezel.
SurfaceMut
One surface borrowed together with its shell: the handle a platform delivers a window’s events through and reads a window’s frame from.
TouchRouter
Routes the fingers on one surface to the shell’s primary and secondary pointers. F is the platform’s identity of a finger. None stands for a mouse, which always drives the primary pointer.
WheelScroll
A mouse-wheel or trackpad scroll sample ready for AppShell::wheel_scrolled.

Enums§

FramePacingMode
How the shell paces its frames against the display.
FrameRatePreference
How the platform should vote the display’s frame rate on behalf of the app.
Key
A key on a keyboard, remote control or game controller, named as in Jetpack Compose’s androidx.compose.ui.input.key.Key.
KeyEventType
Type of keyboard event.
PointerSource
The kind of physical device that produced a pointer event.
RootId
Names a root surface of the app: the primary window, or a window root declared with Modifier::window_root by the id given there.

Constants§

DEFAULT_ROTARY_SCROLL_FACTOR_DP
Android’s default vertical scroll factor expressed in density-independent pixels.

Traits§

PlatformFrameDriver
The platform’s way of waking its loop, used by FrameScheduler to carry out a FrameSchedule.
PlatformTextInputHandler
Callbacks a platform installs to control its on-screen keyboard.

Functions§

default_root_key
Returns the standard root key to pass to the shell constructors. It is the same on every call.
rotary_scroll_pixels_from_detents
Converts a raw Android AXIS_SCROLL detent value into pixels using Compose’s sign convention: positive detents (crown turned up/away) produce a negative pixel amount.