mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
Make 'current_monitor' return 'Option<MonitorHandle>'
On certain platforms window couldn't be on any monitor resulting in failures of 'current_monitor' function. Such issue was happening on Wayland, since the window isn't on any monitor, unless the user has drawn something into it. Returning 'Option<MonitorHandle>' will give an ability to handle such situations gracefully by properly indicating that there's no current monitor. Fixes #793.
This commit is contained in:
@@ -391,10 +391,10 @@ impl Window {
|
||||
v
|
||||
}
|
||||
|
||||
pub fn current_monitor(&self) -> monitor::MonitorHandle {
|
||||
monitor::MonitorHandle {
|
||||
pub fn current_monitor(&self) -> Option<monitor::MonitorHandle> {
|
||||
Some(monitor::MonitorHandle {
|
||||
inner: MonitorHandle,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn scale_factor(&self) -> f64 {
|
||||
|
||||
Reference in New Issue
Block a user