Skip to main content

attach_child_window

Function attach_child_window 

Source
pub fn attach_child_window(parent: &Window, child: &Window)
Expand description

Attach child as a child window of parent using NSWindowOrderingMode::Above on macOS. Call this after both windows’ AccessKit adapters have been created (and thus after the child becomes visible). Works for modal and non-modal parented windows alike — popover-as-window, inspector palettes, floating tool panels are all expected to route through this path as the multi-window system matures.

On non-macOS targets the parent relationship is already set by winit’s WindowAttributes::with_parent_window at creation time, so this is a no-op. macOS needs the deferred call because AppKit’s -[NSWindow addChildWindow:ordered:] orders the child window front (making it visible), which conflicts with AccessKit’s requirement that its adapter be created while the window is still hidden.