mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
Fix no primary monitor panic in XWayland (#318)
* Fix no primary monitor panic in XWayland In this case try to use the first existing monitor instead of panicking. Fixes #317 * Shift no monitor panic to x11::get_primary_monitor * Update changelog with xll get_primary_monitor fallback
This commit is contained in:
parent
36058ab8e6
commit
b3c5ee6219
|
@ -13,6 +13,7 @@
|
||||||
`EnumDisplayDevices`. This changes the value returned by `MonitorId::get_name()`.
|
`EnumDisplayDevices`. This changes the value returned by `MonitorId::get_name()`.
|
||||||
- On Windows added `MonitorIdExt::hmonitor` method
|
- On Windows added `MonitorIdExt::hmonitor` method
|
||||||
- Impl `Clone` for `EventsLoopProxy`
|
- Impl `Clone` for `EventsLoopProxy`
|
||||||
|
- `EventsLoop::get_primary_monitor()` on X11 will fallback to any available monitor if no primary is found
|
||||||
|
|
||||||
# Version 0.8.3 (2017-10-11)
|
# Version 0.8.3 (2017-10-11)
|
||||||
|
|
||||||
|
|
|
@ -75,13 +75,10 @@ pub fn get_available_monitors(x: &Arc<XConnection>) -> Vec<MonitorId> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_primary_monitor(x: &Arc<XConnection>) -> MonitorId {
|
pub fn get_primary_monitor(x: &Arc<XConnection>) -> MonitorId {
|
||||||
for monitor in get_available_monitors(x) {
|
get_available_monitors(x).into_iter().find(|m| m.primary)
|
||||||
if monitor.primary {
|
// 'no primary' case is better handled picking some existing monitor
|
||||||
return monitor.clone()
|
.or_else(|| get_available_monitors(x).into_iter().next())
|
||||||
}
|
.expect("[winit] Failed to find any x11 monitor")
|
||||||
}
|
|
||||||
|
|
||||||
panic!("[winit] Failed to find the primary monitor")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MonitorId {
|
impl MonitorId {
|
||||||
|
|
Loading…
Reference in a new issue