logo
pub struct Window { /* private fields */ }
Expand description

An operating system window that can present content and receive user input.

Window Sizes

There are three sizes associated with a window. The physical size which is the height and width in physical pixels on the monitor. The logical size which is the physical size scaled by an operating system provided factor to account for monitors with differing pixel densities or user preference. And the requested size, measured in logical pixels, which is the value submitted to the API when creating the window, or requesting that it be resized.

The actual size, in logical pixels, of the window may not match the requested size due to operating system limits on the window size, or the quantization of the logical size when converting the physical size to the logical size through the scaling factor.

Implementations

The current logical width of the window’s client area.

The current logical height of the window’s client area.

The requested window client area width in logical pixels from window creation or the last call to set_resolution.

This may differ from the actual width depending on OS size limits and the scaling factor for high DPI monitors.

The requested window client area height in logical pixels from window creation or the last call to set_resolution.

This may differ from the actual width depending on OS size limits and the scaling factor for high DPI monitors.

The window’s client area width in physical pixels.

The window’s client area height in physical pixels.

The window’s client resize constraint in logical pixels.

The window’s client position in physical pixels.

Sets the window to minimized or back.

Platform-specific
  • iOS / Android / Web: Unsupported.
  • Wayland: Un-minimize is unsupported.

Modifies the position of the window in physical pixels.

Note that the top-left hand corner of the desktop is not necessarily the same as the screen. If the user uses a desktop with multiple monitors, the top-left hand corner of the desktop is the top-left hand corner of the monitor at the top-left of the desktop. This automatically un-maximizes the window if it’s maximized.

Platform-specific
  • iOS: Can only be called on the main thread. Sets the top left coordinates of the window in the screen space coordinate system.
  • Web: Sets the top-left coordinates relative to the viewport.
  • Android / Wayland: Unsupported.

Modifies the minimum and maximum window bounds for resizing in logical pixels.

Request the OS to resize the window such the the client area matches the specified width and height.

Override the os-reported scaling factor

The ratio of physical pixels to logical pixels

physical_pixels = logical_pixels * scale_factor

The window scale factor as reported by the window backend. This value is unaffected by scale_factor_override.

The current mouse position, in physical pixels.

The current mouse position, in logical pixels, taking into account the screen scale factor.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert 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. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more