Make 'primary_monitor' return 'Option<MonitorHandle>'
Certain platforms like Wayland don't have a concept of primary Monitor in particular. To indicate that 'primary_monitor' will return 'None' as well as in cases where the primary monitor can't be detected. Fixes #1683.
This commit is contained in:
parent
cac627ed05
commit
d103dc2631
16 changed files with 86 additions and 56 deletions
|
|
@ -2,6 +2,7 @@ use super::{super::monitor, backend, device, proxy::Proxy, runner, window};
|
|||
use crate::dpi::{PhysicalSize, Size};
|
||||
use crate::event::{DeviceId, ElementState, Event, KeyboardInput, TouchPhase, WindowEvent};
|
||||
use crate::event_loop::ControlFlow;
|
||||
use crate::monitor::MonitorHandle as RootMH;
|
||||
use crate::window::{Theme, WindowId};
|
||||
use std::clone::Clone;
|
||||
use std::collections::{vec_deque::IntoIter as VecDequeIter, VecDeque};
|
||||
|
|
@ -237,7 +238,9 @@ impl<T> WindowTarget<T> {
|
|||
VecDeque::new().into_iter()
|
||||
}
|
||||
|
||||
pub fn primary_monitor(&self) -> monitor::Handle {
|
||||
monitor::Handle
|
||||
pub fn primary_monitor(&self) -> Option<RootMH> {
|
||||
Some(RootMH {
|
||||
inner: monitor::Handle,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,8 +255,10 @@ impl Window {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn primary_monitor(&self) -> monitor::Handle {
|
||||
monitor::Handle
|
||||
pub fn primary_monitor(&self) -> Option<RootMH> {
|
||||
Some(RootMH {
|
||||
inner: monitor::Handle,
|
||||
})
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue