Skip to main content

Module queue

Module queue 

Source
Expand description

The command queue: the channel between a host and the app.

A host calls AutomationQueue::submit with an Envelope and gets a receiver for the Reply. The app drains the queue at three fixed points in the frame (§4.4): drain_input in raw_input_hook, then drain_app for Phase::Mutate at the top of ui and for Phase::Read at the bottom. A command waits in the queue until its phase comes round.

A desktop window is not always drawn: a Wayland compositor sends no frame callbacks to a window on a hidden workspace, and winit then withholds RedrawRequested indefinitely. So no command waits for one. A submit calls the waker, which wakes the desktop event loop independently of egui’s repaint bookkeeping, and the loop dispatches the queue’s head with drain_frameless (desktop_loop). What a command needs first is its Need: app state (dispatched at once), a current layout (dispatched at once while the last pass is current, else after one), or a pass of its own (input egui must apply, a capture of what a pass draws). For the last two the loop runs an egui pass itself, on demand, without presenting it (needs_pass); the pass drains the queue exactly as a drawn frame does, so the queue’s order is kept.

Structs§

AutomationQueue
Pending

Enums§

Need
What a command needs before it can be dispatched outside a drawn pass.
Withdrawn
What became of a command whose host stopped waiting for it (AutomationQueue::withdraw).

Constants§

ENGINE_ONLY
Commands that read or write only a document’s ENGINE — its history, run, metadata, model and exports — and so may run on a background tab: the queue routes them there for the one handler call (Documents::route_begin) without touching what the user sees. Every other command acts on the visible document and refuses a background context (document_not_active).
LAYOUT_BOUND
App commands that read the layout a pass publishes. state_get and state_schema are here only for a name that is not a plain-state blob (automation::state_blobs): those are built from the app at dispatch.
LAYOUT_FRESH
How long the last pass’s layout stands for a layout read when nothing has changed since: one frame at 60 Hz, the age a drawn window’s layout has. Older than that, time alone may have moved it (a toast expiring, the working indicator appearing), so the read gets a pass of its own.
PASS_BOUND
App commands that need a pass of their own: the captures (the image IS a pass), the presentation loan a capture series runs under, and ping, which answers from the next pass (the composite tools step the app with it).

Functions§

need
What spec called with args needs (Need).

Type Aliases§

Waker
Wakes the thread that owns the app when work is queued.