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
|
|
@ -34,6 +34,7 @@ use crate::{
|
|||
dpi::{PhysicalPosition, PhysicalSize},
|
||||
event::{DeviceEvent, Event, Force, KeyboardInput, Touch, TouchPhase, WindowEvent},
|
||||
event_loop::{ControlFlow, EventLoopClosed, EventLoopWindowTarget as RootELW},
|
||||
monitor::MonitorHandle as RootMonitorHandle,
|
||||
platform_impl::platform::{
|
||||
dark_mode::try_dark_mode,
|
||||
dpi::{become_dpi_aware, dpi_to_scale_factor, enable_non_client_dpi_scaling},
|
||||
|
|
@ -255,8 +256,9 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
monitor::available_monitors()
|
||||
}
|
||||
|
||||
pub fn primary_monitor(&self) -> MonitorHandle {
|
||||
monitor::primary_monitor()
|
||||
pub fn primary_monitor(&self) -> Option<RootMonitorHandle> {
|
||||
let monitor = monitor::primary_monitor();
|
||||
Some(RootMonitorHandle { inner: monitor })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,8 +131,9 @@ impl Window {
|
|||
available_monitors()
|
||||
}
|
||||
|
||||
pub fn primary_monitor(&self) -> MonitorHandle {
|
||||
primary_monitor()
|
||||
pub fn primary_monitor(&self) -> Option<RootMonitorHandle> {
|
||||
let monitor = primary_monitor();
|
||||
Some(RootMonitorHandle { inner: monitor })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue