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
|
|
@ -333,13 +333,15 @@ pub struct EventLoopWindowTarget<T: 'static> {
|
|||
}
|
||||
|
||||
impl<T: 'static> EventLoopWindowTarget<T> {
|
||||
pub fn primary_monitor(&self) -> MonitorHandle {
|
||||
MonitorHandle
|
||||
pub fn primary_monitor(&self) -> Option<monitor::MonitorHandle> {
|
||||
Some(monitor::MonitorHandle {
|
||||
inner: MonitorHandle,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn available_monitors(&self) -> VecDeque<MonitorHandle> {
|
||||
let mut v = VecDeque::with_capacity(1);
|
||||
v.push_back(self.primary_monitor());
|
||||
v.push_back(MonitorHandle);
|
||||
v
|
||||
}
|
||||
}
|
||||
|
|
@ -381,8 +383,10 @@ impl Window {
|
|||
WindowId
|
||||
}
|
||||
|
||||
pub fn primary_monitor(&self) -> MonitorHandle {
|
||||
MonitorHandle
|
||||
pub fn primary_monitor(&self) -> Option<monitor::MonitorHandle> {
|
||||
Some(monitor::MonitorHandle {
|
||||
inner: MonitorHandle,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn available_monitors(&self) -> VecDeque<MonitorHandle> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue