Handles an event from the rest of the process and updates the state
(&mut self, event: Event<'_, GlutinThreadEvent>, window_target: &EventLoopWindowTarget<GlutinThreadEvent>, control_flow: &mut ControlFlow)
| 84 | /// Handles an event from the rest of the process and updates the state |
| 85 | /// |
| 86 | pub fn handle_event(&mut self, event: Event<'_, GlutinThreadEvent>, window_target: &EventLoopWindowTarget<GlutinThreadEvent>, control_flow: &mut ControlFlow) { |
| 87 | use Event::*; |
| 88 | |
| 89 | if *control_flow != ControlFlow::Exit { |
| 90 | *control_flow = ControlFlow::Wait; |
| 91 | } |
| 92 | |
| 93 | match event { |
| 94 | NewEvents(_cause) => { } |
| 95 | WindowEvent { window_id, event } => { self.handle_window_event(window_id, event); } |
| 96 | DeviceEvent { device_id: _, event: _ } => { } |
| 97 | UserEvent(thread_event) => { self.handle_thread_event(thread_event, window_target); } |
| 98 | Suspended => { } |
| 99 | Resumed => { } |
| 100 | RedrawRequested(window_id) => { self.request_redraw(window_id); } |
| 101 | |
| 102 | MainEventsCleared => { |
| 103 | // Glutin doesn't always respond to ControlFlow::Exit requests, setting it after the other events have cleared is an attempt |
| 104 | // to make it exit more reliably (only partially successful). |
| 105 | if self.will_exit { |
| 106 | *control_flow = ControlFlow::Exit; |
| 107 | } |
| 108 | } |
| 109 | RedrawEventsCleared => { } |
| 110 | LoopDestroyed => { } |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | /// |
| 115 | /// Handles a glutin window event |
no test coverage detected