Update examples to winit 0.29
This commit is contained in:
parent
d6224e1b03
commit
555678e6ed
4 changed files with 56 additions and 50 deletions
|
|
@ -1,12 +1,12 @@
|
|||
use window_clipboard::Clipboard;
|
||||
use winit::{
|
||||
event::{Event, WindowEvent},
|
||||
event_loop::{ControlFlow, EventLoop},
|
||||
event_loop::EventLoop,
|
||||
window::WindowBuilder,
|
||||
};
|
||||
|
||||
fn main() {
|
||||
let event_loop = EventLoop::new();
|
||||
let event_loop = EventLoop::new().unwrap();
|
||||
|
||||
let window = WindowBuilder::new()
|
||||
.with_title("A fantastic window!")
|
||||
|
|
@ -15,14 +15,16 @@ fn main() {
|
|||
|
||||
let clipboard = Clipboard::connect(&window).expect("Connect to clipboard");
|
||||
|
||||
event_loop.run(move |event, _, control_flow| match event {
|
||||
Event::MainEventsCleared => {
|
||||
println!("{:?}", clipboard.read());
|
||||
}
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
window_id,
|
||||
} if window_id == window.id() => *control_flow = ControlFlow::Exit,
|
||||
_ => *control_flow = ControlFlow::Wait,
|
||||
});
|
||||
event_loop
|
||||
.run(move |event, elwt| match event {
|
||||
Event::AboutToWait => {
|
||||
println!("{:?}", clipboard.read());
|
||||
}
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
window_id,
|
||||
} if window_id == window.id() => elwt.exit(),
|
||||
_ => {}
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue