diff --git a/examples/request_redraw.rs b/examples/request_redraw.rs index 35ef4a12..ac9377e7 100644 --- a/examples/request_redraw.rs +++ b/examples/request_redraw.rs @@ -14,19 +14,21 @@ fn main() { .build(&event_loop) .unwrap(); - event_loop.run(move |event, _, control_flow| { - println!("{:?}", event); - - match event { - Event::WindowEvent { - event: WindowEvent::CloseRequested, - .. - } => *control_flow = ControlFlow::Exit, - Event::EventsCleared => { - window.request_redraw(); - *control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::new(1, 0)) - } - _ => (), + event_loop.run(move |event, _, control_flow| match event { + Event::WindowEvent { + event: WindowEvent::CloseRequested, + .. + } => *control_flow = ControlFlow::Exit, + Event::EventsCleared => { + window.request_redraw(); + *control_flow = ControlFlow::WaitUntil(Instant::now() + Duration::new(1, 0)) } + Event::WindowEvent { + event: WindowEvent::RedrawRequested, + .. + } => { + println!("{:?}", event); + } + _ => (), }); }