Skip to main content

dispatch_event_broadcast

Function dispatch_event_broadcast 

Source
pub fn dispatch_event_broadcast(
    root: &mut Box<dyn Widget>,
    event: &Event,
    pos_in_root: Point,
) -> EventResult
Expand description

Offer event to every visible widget in the subtree, depth-first with the same topmost-last-child priority as hit_test_subtree, stopping at the first consumer. Positions are translated into each widget’s local space on the way down, exactly like dispatch_event.

This exists for events that must not be lost when the widget under their position ignores them — file drops foremost: native shells can’t always produce an accurate drop position (winit’s Windows backend discards the OLE drop point and emits no CursorMoved during the drag), so the position may point at chrome while the only interested handler (a canvas) sits in a sibling subtree the bubble path never reaches.