summaryrefslogtreecommitdiff
path: root/engine/src/windowing/monitor.rs
blob: ef06b36b4cfd3bef97f013ac5fca61b403282b28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::windowing::dpi::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
{
    pub fn name(&self) -> Option<String>
    {
        self.inner.name()
    }

    pub fn size(&self) -> PhysicalSize<u32>
    {
        self.inner.size().into()
    }
}

impl Handle
{
    pub(super) fn from_winit_monitor_handle(
        monitor: winit::monitor::MonitorHandle,
    ) -> Self
    {
        Self { inner: monitor }
    }
}