Events loop backend (#269)

* Don't use UNIX_BACKEND in Window2::new

* Move get_available_monitors and get_primary_monitor to EventsLoop

* Remove UNIX_BACKEND

* Restore choosing the Linux backend

* Return a XNotSupported for new_x11()

* Fix fullscreen example
This commit is contained in:
tomaka 2017-09-01 11:04:57 +02:00 committed by GitHub
parent e65cacbc86
commit 3d1c18ded9
13 changed files with 227 additions and 214 deletions

View file

@ -4,9 +4,11 @@ use std::io::{self, Write};
use winit::{ControlFlow, Event, WindowEvent, FullScreenState};
fn main() {
let mut events_loop = winit::EventsLoop::new();
// enumerating monitors
let monitor = {
for (num, monitor) in winit::get_available_monitors().enumerate() {
for (num, monitor) in events_loop.get_available_monitors().enumerate() {
println!("Monitor #{}: {:?}", num, monitor.get_name());
}
@ -16,15 +18,13 @@ fn main() {
let mut num = String::new();
io::stdin().read_line(&mut num).unwrap();
let num = num.trim().parse().ok().expect("Please enter a number");
let monitor = winit::get_available_monitors().nth(num).expect("Please enter a valid ID");
let monitor = events_loop.get_available_monitors().nth(num).expect("Please enter a valid ID");
println!("Using {:?}", monitor.get_name());
monitor
};
let mut events_loop = winit::EventsLoop::new();
let _window = winit::WindowBuilder::new()
.with_title("Hello world!")
.with_fullscreen(FullScreenState::Exclusive(monitor))