mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-02 23:00:05 -04:00
On Windows, fix invalid hmonitor panic
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
committed by
Kirill Chibisov
parent
20384d2f02
commit
f6cc6c1472
@@ -209,11 +209,15 @@ impl MonitorHandle {
|
|||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn position(&self) -> PhysicalPosition<i32> {
|
pub fn position(&self) -> PhysicalPosition<i32> {
|
||||||
let rc_monitor = get_monitor_info(self.0).unwrap().monitorInfo.rcMonitor;
|
get_monitor_info(self.0)
|
||||||
PhysicalPosition {
|
.map(|info| {
|
||||||
x: rc_monitor.left,
|
let rc_monitor = info.monitorInfo.rcMonitor;
|
||||||
y: rc_monitor.top,
|
PhysicalPosition {
|
||||||
}
|
x: rc_monitor.left,
|
||||||
|
y: rc_monitor.top,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.unwrap_or(PhysicalPosition { x: 0, y: 0 })
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
Reference in New Issue
Block a user