pub struct WindowRestoreState {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
pub maximized: bool,
pub fullscreen: bool,
pub display_id: Option<u64>,
pub display_uuid: Option<[u8; 16]>,
pub scale_factor: f32,
}Expand description
Persistable window geometry and display identity.
Capture it with WindowState::restore_state and apply it with WindowOptions::restore.
The struct is serde-serializable so an application can store it next to its own settings.
Every field is validated on the way back in; a stale or hostile value can never place a
window off every connected display.
Fields§
§x: f32Windowed restore rectangle in global logical desktop coordinates.
y: f32§width: f32§height: f32§maximized: bool§fullscreen: bool§display_id: Option<u64>Process-level display identifier captured with the bounds, when one was known.
display_uuid: Option<[u8; 16]>Stable physical display identity captured with the bounds, when the platform exposes one.
scale_factor: f32Scale factor of the capturing display, used only as a sanity signal.
Implementations§
Source§impl WindowRestoreState
impl WindowRestoreState
Sourcepub const fn new(bounds: Rect) -> Self
pub const fn new(bounds: Rect) -> Self
Build a restore state from an explicit windowed rectangle.
Sourcepub const fn bounds(&self) -> Rect
pub const fn bounds(&self) -> Rect
Persisted windowed rectangle in global logical desktop coordinates.
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Whether the persisted values are finite and inside the supported desktop range.
Sourcepub fn resolve(&self, displays: &Displays) -> ResolvedWindowRestoreState
pub fn resolve(&self, displays: &Displays) -> ResolvedWindowRestoreState
Resolve this state against a live display snapshot.
The remembered display is matched by stable UUID first and by process identifier second. A rectangle that still intersects that display’s work area is kept exactly; otherwise it is clamped into the work area. When no remembered display is connected and the rectangle intersects no work area at all, the window is centered on the primary display.
Trait Implementations§
Source§impl Clone for WindowRestoreState
impl Clone for WindowRestoreState
Source§fn clone(&self) -> WindowRestoreState
fn clone(&self) -> WindowRestoreState
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 WindowRestoreState
Source§impl Debug for WindowRestoreState
impl Debug for WindowRestoreState
Source§impl<'de> Deserialize<'de> for WindowRestoreState
impl<'de> Deserialize<'de> for WindowRestoreState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for WindowRestoreState
impl PartialEq for WindowRestoreState
Source§impl Serialize for WindowRestoreState
impl Serialize for WindowRestoreState
impl StructuralPartialEq for WindowRestoreState
Auto Trait Implementations§
impl Freeze for WindowRestoreState
impl RefUnwindSafe for WindowRestoreState
impl Send for WindowRestoreState
impl Sync for WindowRestoreState
impl Unpin for WindowRestoreState
impl UnsafeUnpin for WindowRestoreState
impl UnwindSafe for WindowRestoreState
Blanket Implementations§
impl<T> Action for T
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.