mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
d103dc2631
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.
20 lines
448 B
Rust
20 lines
448 B
Rust
use winit::event_loop::EventLoop;
|
|
|
|
fn main() {
|
|
simple_logger::init().unwrap();
|
|
let event_loop = EventLoop::new();
|
|
let monitor = match event_loop.primary_monitor() {
|
|
Some(monitor) => monitor,
|
|
None => {
|
|
println!("No primary monitor detected.");
|
|
return;
|
|
}
|
|
};
|
|
|
|
println!("Listing available video modes:");
|
|
|
|
for mode in monitor.video_modes() {
|
|
println!("{}", mode);
|
|
}
|
|
}
|