use crate::windowing::dpi::{PhysicalPosition, PhysicalSize}; /// Handle to a monitor that may or may not exist any longer. #[derive(Debug, Clone)] pub struct Handle { inner: winit::monitor::MonitorHandle, } impl Handle { /// Returns a human-readable name of the monitor. #[inline] pub fn name(&self) -> Option { self.inner.name() } /// Returns the monitor's resolution. #[inline] pub fn size(&self) -> PhysicalSize { self.inner.size().into() } /// Returns the top-left corner position of the monitor relative to the larger full /// screen area. #[inline] pub fn position(&self) -> PhysicalPosition { self.inner.position().into() } /// Returns the scale factor of the underlying monitor. #[inline] pub fn scale_factor(&self) -> f64 { self.inner.scale_factor() } } impl Handle { pub(super) fn from_winit_monitor_handle( monitor: winit::monitor::MonitorHandle, ) -> Self { Self { inner: monitor } } }