pub enum CallbackChange {
Show 65 variants
ModifyWindowState {
state: FullWindowState,
},
InjectNativeGesture {
gesture: NativeGestureEvent,
},
QueueWindowStateSequence {
states: Vec<FullWindowState>,
},
CreateNewWindow {
options: WindowCreateOptions,
},
CloseWindow,
SetFocusTarget {
target: FocusTarget,
},
StopPropagation,
StopImmediatePropagation,
PreventDefault,
AddTimer {
timer_id: TimerId,
timer: Timer,
},
RemoveTimer {
timer_id: TimerId,
},
AddThread {
thread_id: ThreadId,
thread: Thread,
},
RemoveThread {
thread_id: ThreadId,
},
ChangeNodeText {
node_id: DomNodeId,
text: AzString,
},
ChangeNodeImage {
dom_id: DomId,
node_id: NodeId,
image: ImageRef,
update_type: UpdateImageType,
},
UpdateImageCallback {
dom_id: DomId,
node_id: NodeId,
},
UpdateAllImageCallbacks,
UpdateVirtualView {
dom_id: DomId,
node_id: NodeId,
},
ChangeNodeImageMask {
dom_id: DomId,
node_id: NodeId,
mask: ImageMask,
},
ChangeNodeCssProperties {
dom_id: DomId,
node_id: NodeId,
properties: CssPropertyVec,
},
OverrideNodeCssProperties {
dom_id: DomId,
node_id: NodeId,
properties: CssPropertyVec,
},
ScrollTo {
dom_id: DomId,
node_id: NodeHierarchyItemId,
position: LogicalPosition,
unclamped: bool,
},
ScrollIntoView {
node_id: DomNodeId,
options: ScrollIntoViewOptions,
},
AddImageToCache {
id: AzString,
image: ImageRef,
},
RemoveImageFromCache {
id: AzString,
},
ReloadSystemFonts,
OpenMenu {
menu: Menu,
position: Option<LogicalPosition>,
},
ShowTooltip {
text: AzString,
position: LogicalPosition,
},
HideTooltip,
InsertText {
dom_id: DomId,
node_id: NodeId,
text: AzString,
},
DeleteBackward {
dom_id: DomId,
node_id: NodeId,
},
DeleteForward {
dom_id: DomId,
node_id: NodeId,
},
MoveCursor {
dom_id: DomId,
node_id: NodeId,
cursor: TextCursor,
},
SetSelection {
dom_id: DomId,
node_id: NodeId,
selection: Selection,
},
SetTextChangeset {
changeset: PendingTextEdit,
},
MoveCursorLeft {
dom_id: DomId,
node_id: NodeId,
extend_selection: bool,
},
MoveCursorRight {
dom_id: DomId,
node_id: NodeId,
extend_selection: bool,
},
MoveCursorUp {
dom_id: DomId,
node_id: NodeId,
extend_selection: bool,
},
MoveCursorDown {
dom_id: DomId,
node_id: NodeId,
extend_selection: bool,
},
MoveCursorToLineStart {
dom_id: DomId,
node_id: NodeId,
extend_selection: bool,
},
MoveCursorToLineEnd {
dom_id: DomId,
node_id: NodeId,
extend_selection: bool,
},
MoveCursorToDocumentStart {
dom_id: DomId,
node_id: NodeId,
extend_selection: bool,
},
MoveCursorToDocumentEnd {
dom_id: DomId,
node_id: NodeId,
extend_selection: bool,
},
AddCursor {
dom_id: DomId,
node_id: NodeId,
cursor: TextCursor,
},
AddSelectionRange {
dom_id: DomId,
node_id: NodeId,
range: SelectionRange,
},
RemoveSelectionById {
selection_id: SelectionId,
},
SetCopyContent {
target: DomNodeId,
content: ClipboardContent,
},
SetCutContent {
target: DomNodeId,
content: ClipboardContent,
},
SetSelectAllRange {
target: DomNodeId,
range: SelectionRange,
},
RequestHitTestUpdate {
position: LogicalPosition,
},
ProcessTextSelectionClick {
position: LogicalPosition,
time_ms: u64,
},
SetCursorVisibility {
visible: bool,
},
ResetCursorBlink,
StartCursorBlinkTimer,
StopCursorBlinkTimer,
ScrollActiveCursorIntoView,
CreateTextInput {
text: AzString,
},
BeginInteractiveMove,
SetDragData {
mime_type: AzString,
data: Vec<u8>,
},
AcceptDrop,
SetDropEffect {
effect: DropEffect,
},
InsertChildNode {
dom_id: DomId,
parent_node_id: NodeId,
node_type_str: AzString,
position: Option<usize>,
classes: Vec<AzString>,
id: Option<AzString>,
},
DeleteNode {
dom_id: DomId,
node_id: NodeId,
},
SetNodeIdsAndClasses {
dom_id: DomId,
node_id: NodeId,
ids_and_classes: IdOrClassVec,
},
SwitchRoute {
pattern: AzString,
params: StringPairVec,
},
}Expand description
Represents a change made by a callback that will be applied after the callback returns
This transaction-based system provides:
- Clear separation between read-only queries and modifications
- Atomic application of all changes
- Easy debugging and logging of callback actions
- Future extensibility for new change types
Variants§
ModifyWindowState
Modify the window state (size, position, title, etc.)
Fields
state: FullWindowStateInjectNativeGesture
Inject a platform-native gesture-recognizer result into the
in-process GestureAndDragManager. Read by the next
detect_long_press / detect_swipe_direction / detect_pinch /
detect_rotation / detect_double_click call, then cleared.
Fields
gesture: NativeGestureEventQueueWindowStateSequence
Queue multiple window state changes to be applied in sequence across frames. This is needed for simulating clicks (mouse down -> wait -> mouse up) where each state change needs to trigger separate event processing.
Fields
states: Vec<FullWindowState>CreateNewWindow
Create a new window
Fields
options: WindowCreateOptionsCloseWindow
Close the current window (via Update::CloseWindow return value, tracked here for logging)
SetFocusTarget
Change keyboard focus to a specific node or clear focus
Fields
target: FocusTargetStopPropagation
Stop event from propagating to parent nodes (W3C stopPropagation). Remaining handlers on the current node still fire, but no handlers on ancestor / descendant nodes in subsequent phases.
StopImmediatePropagation
Stop event propagation immediately (W3C stopImmediatePropagation). No further handlers fire - not even remaining handlers on the same node.
PreventDefault
Prevent default browser behavior (e.g., block text input from being applied)
AddTimer
Add a new timer to the window
RemoveTimer
Remove an existing timer
AddThread
Add a new background thread
RemoveThread
Remove an existing thread
ChangeNodeText
Change the text content of a node
ChangeNodeImage
Change the image of a node
UpdateImageCallback
Re-render an image callback (for resize/animation) This triggers re-invocation of the RenderImageCallback
UpdateAllImageCallbacks
Re-render ALL image callbacks across all DOMs.
This is the most efficient way to update animated GL textures: it triggers only texture re-rendering without DOM rebuild or display list resubmission. Used by timer callbacks that need to update OpenGL textures every frame.
UpdateVirtualView
Trigger re-rendering of a VirtualView with a new DOM This forces the VirtualView to call its callback and update the display list
ChangeNodeImageMask
Change the image mask of a node
ChangeNodeCssProperties
Change CSS properties of a node
OverrideNodeCssProperties
Override CSS properties on a node via the user-override channel
(CssPropertyCache::user_overridden_properties). Unlike
ChangeNodeCssProperties, this does not mutate the node’s static
css_props - the override layer is read at higher priority by the
property resolution pipeline, so animating a handful of properties
per frame stays cheap. Passing CssProperty::Initial for a property
removes any prior override for that type on the same node.
ScrollTo
Scroll a node to a specific position
ScrollIntoView
Scroll a node into view (W3C scrollIntoView API) The scroll adjustments are calculated and applied when the change is processed
AddImageToCache
Add an image to the image cache
RemoveImageFromCache
Remove an image from the image cache
ReloadSystemFonts
Reload system fonts (expensive operation)
OpenMenu
Open a context menu or dropdown menu Whether it’s native or fallback depends on window.state.flags.use_native_context_menus
ShowTooltip
Show a tooltip at a specific position
Platform-specific implementation:
- Windows: Uses native tooltip window (TOOLTIPS_CLASS)
- macOS: Uses NSPopover or custom NSWindow with tooltip styling
- X11: Creates transient window with _NET_WM_WINDOW_TYPE_TOOLTIP
- Wayland: Creates surface with zwlr_layer_shell_v1 (overlay layer)
HideTooltip
Hide the currently displayed tooltip
InsertText
Insert text at the current cursor position or replace selection
DeleteBackward
Delete text backward (backspace) at cursor
DeleteForward
Delete text forward (delete key) at cursor
MoveCursor
Move cursor to a specific position
SetSelection
Set text selection range
SetTextChangeset
Set/override the text changeset for the current text input operation This allows callbacks to modify what text will be inserted during text input events
Fields
changeset: PendingTextEditMoveCursorLeft
Move cursor left (arrow left)
MoveCursorRight
Move cursor right (arrow right)
MoveCursorUp
Move cursor up (arrow up)
MoveCursorDown
Move cursor down (arrow down)
MoveCursorToLineStart
Move cursor to line start (Home key)
MoveCursorToLineEnd
Move cursor to line end (End key)
MoveCursorToDocumentStart
Move cursor to document start (Ctrl+Home)
MoveCursorToDocumentEnd
Move cursor to document end (Ctrl+End)
AddCursor
Add an additional cursor at the specified position (Ctrl+Click from C API)
AddSelectionRange
Add an additional selection range (for multi-cursor)
RemoveSelectionById
Remove a specific selection by its stable ID
Fields
selection_id: SelectionIdSetCopyContent
Override clipboard content for copy operation
SetCutContent
Override clipboard content for cut operation
SetSelectAllRange
Override selection range for select-all operation
RequestHitTestUpdate
Request a hit test update at a specific position
This is used by the Debug API to update the hover manager’s hit test data after modifying the mouse position, ensuring that callbacks can find the correct nodes under the cursor.
Fields
position: LogicalPositionProcessTextSelectionClick
Process a text selection click at a specific position
This is used by the Debug API to trigger text selection directly, bypassing the normal event pipeline. The handler will:
- Hit-test IFC roots to find selectable text at the position
- Create a text cursor at the clicked position
- Update the selection manager with the new selection
SetCursorVisibility
Set the cursor visibility state (called by blink timer)
ResetCursorBlink
Reset cursor blink state on user input (makes cursor visible, records time)
StartCursorBlinkTimer
Start the cursor blink timer for the focused contenteditable element
StopCursorBlinkTimer
Stop the cursor blink timer (when focus leaves contenteditable)
ScrollActiveCursorIntoView
Scroll the active text cursor into view within its scrollable container This is automatically triggered after text input or cursor movement
CreateTextInput
Create a synthetic text input event
This simulates receiving text input from the OS. The text input flow will:
- Record the text in TextInputManager (creating a PendingTextEdit)
- Generate synthetic TextInput events
- Invoke user callbacks (which can intercept/reject via preventDefault)
- Apply the changeset if not rejected
- Mark dirty nodes for re-render
BeginInteractiveMove
Request the compositor to begin an interactive window move. On Wayland: calls xdg_toplevel_move(toplevel, seat, serial). On other platforms: this is a no-op (use set_window_position instead).
SetDragData
Set drag data for a MIME type (W3C: dataTransfer.setData) Should be called in a DragStart callback to populate the drag data.
AcceptDrop
Accept the current drop on this target (W3C: event.preventDefault() in DragOver) Must be called from a DragOver or DragEnter callback for the Drop event to fire.
SetDropEffect
Set the drop effect (W3C: dataTransfer.dropEffect)
Fields
effect: DropEffectInsertChildNode
Insert a new child node into the DOM tree. Creates a minimal StyledDom from the given node_type and appends it as a child of parent_node_id. If position is Some, inserts at that child index; otherwise appends at the end.
Fields
DeleteNode
Delete a node from the DOM tree (and all its children). The node is “tombstoned” (set to an empty anonymous Div) rather than physically removed, to preserve node ID stability.
SetNodeIdsAndClasses
Set the IDs and classes on an existing node.
SwitchRoute
Switch to a different route.
On desktop: swaps FullWindowState.layout_callback to the matched
route’s callback, stores the RouteMatch, and triggers RefreshDom.
On web: additionally calls history.pushState().
Fields
params: StringPairVecRoute parameters (e.g. [("id", "42")])
Trait Implementations§
Source§impl Clone for CallbackChange
impl Clone for CallbackChange
Source§fn clone(&self) -> CallbackChange
fn clone(&self) -> CallbackChange
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CallbackChange
impl RefUnwindSafe for CallbackChange
impl Send for CallbackChange
impl Sync for CallbackChange
impl Unpin for CallbackChange
impl UnsafeUnpin for CallbackChange
impl UnwindSafe for CallbackChange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more