pub enum WindowCommand {
StartDrag(WindowId),
Close(WindowId),
Minimize(WindowId),
ToggleMaximize(WindowId),
Open {
id: WindowId,
owner: WindowId,
origin: OriginId,
config: WindowConfig,
},
SetSize {
window: WindowId,
size: Size,
},
Focus(WindowId),
Redraw(WindowId),
}Expand description
A window-level intent for the frame driver, drained via
Core::take_window_commands after each input dispatch and each frame.
Three things produce one: input on a chrome node, the declared set’s
diff, and an app asking directly (Core::set_window_size,
Core::focus_window, Core::push_window_command). A headless driver
never drains, which is the whole of “the core never touches a window”.
Every variant says which window it is about, and every variant is
Copy and pointer-free — an Open carries no title (the new window’s
own first frame declares one through window_title) and a SetSize
carries two floats — so nothing borrowed ever enters a driver’s drain
loop.
Variants§
StartDrag(WindowId)
Begin an interactive OS move (the press landed on a Drag node).
Close(WindowId)
Close this window: from its chrome close button, or because no frame declares it any more. For the main window a driver exits.
Minimize(WindowId)
ToggleMaximize(WindowId)
Open
Open a window the declared set gained. id is the one the core
assigned and will stamp on the window’s events; origin is the
frontend whose declaration won (a host may refuse an extension’s);
owner is the window whose frame that declaration came from — what
a WindowKind::Popup is anchored against and owned by, and what
closing takes the popup with it (the owner’s declarations leave the
declared set when the owner does, so the diff closes the child in
the same pass).
SetSize
Resize window to size (logical px), asked for by the app
(Core::set_window_size). A command and not part of a declaration,
because the user owns a window’s size once it exists — a declared
size would fight every drag of the window’s edge, which is why
WindowConfig::size is read on the opening edge only. The OS may
answer with a different size (a minimum, a tiling manager); the
frame that follows posts a resize event with whatever it actually
became, the way every resize already does.
Focus(WindowId)
Give window keyboard focus (Core::focus_window). Advisory, like
every focus request an app makes of a window manager.
Redraw(WindowId)
Draw window again: something another window’s frame or input
changed is shown there (docs/adr/0024, decision 7 — the devtools
window’s row hover outlines a node in the main window, and an event
the main window logs moves the stream in the devtools window). A
driver that redraws every window on every event may ignore it.
Implementations§
Source§impl WindowCommand
impl WindowCommand
Trait Implementations§
Source§impl Clone for WindowCommand
impl Clone for WindowCommand
Source§fn clone(&self) -> WindowCommand
fn clone(&self) -> WindowCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for WindowCommand
Source§impl Debug for WindowCommand
impl Debug for WindowCommand
Source§impl PartialEq for WindowCommand
impl PartialEq for WindowCommand
impl StructuralPartialEq for WindowCommand
Auto Trait Implementations§
impl Freeze for WindowCommand
impl RefUnwindSafe for WindowCommand
impl Send for WindowCommand
impl Sync for WindowCommand
impl Unpin for WindowCommand
impl UnsafeUnpin for WindowCommand
impl UnwindSafe for WindowCommand
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.