MCPcopy Create free account
hub / github.com/Logicalshift/flo_draw / handle_event

Method handle_event

draw/src/glutin_runtime.rs:86–112  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

run_glutin_threadFunction · 0.80

Calls 3

handle_window_eventMethod · 0.80
handle_thread_eventMethod · 0.80
request_redrawMethod · 0.80

Tested by

no test coverage detected