Struct zng_ext_window::MONITORS
source · pub struct MONITORS;
Expand description
Monitors service.
List monitor screens and configure the PPI of a given monitor.
§Uses
Uses of this service:
§Start Position
Windows are positioned on a virtual screen that overlaps all monitors, but all position configuration is done relative to an specific parent monitor, it is important to track the parent monitor as it defines properties that affect the layout of the window. This service is used to provide information to implement this feature.
§Fullscreen
To set a window to fullscreen a monitor must be selected, by default it can be the one the window is at but
the users may want to select a monitor. To enter fullscreen exclusive the video mode must also be decided, all video
modes supported by the monitor are available in the MonitorInfo
value.
§Real-Size Preview
Some apps, like image editors, may implement a feature where the user can preview the real dimensions of
the content they are editing, to accurately implement this you must known the real dimensions of the monitor screen,
unfortunately this information is not provided by display drivers. You can ask the user to measure their screen and
set the pixel-per-inch ratio for the screen using the ppi
variable, this value is then available in the LayoutMetrics
for the next layout. If not set, the default is 96.0ppi
.
§Provider
This service is provided by the WindowManager
.
Implementations§
source§impl MONITORS
impl MONITORS
sourcepub fn monitor(&self, monitor_id: MonitorId) -> Option<MonitorInfo>
pub fn monitor(&self, monitor_id: MonitorId) -> Option<MonitorInfo>
Get monitor info.
Returns None
if the monitor was not found or the app is running in headless mode without renderer.
sourcepub fn available_monitors(&self) -> Vec<MonitorInfo>
pub fn available_monitors(&self) -> Vec<MonitorInfo>
Iterate over all available monitors.
Is empty if no monitor was found or the app is running in headless mode without renderer.
sourcepub fn primary_monitor(&self) -> Option<MonitorInfo>
pub fn primary_monitor(&self) -> Option<MonitorInfo>
Gets the monitor info marked as primary.
Auto Trait Implementations§
impl Freeze for MONITORS
impl RefUnwindSafe for MONITORS
impl Send for MONITORS
impl Sync for MONITORS
impl Unpin for MONITORS
impl UnwindSafe for MONITORS
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more