@@ -177,37 +177,40 @@ fn main() -> Result<(), impl std::error::Error> {
177177 event_loop. set_control_flow ( ControlFlow :: Wait ) ;
178178
179179 match event {
180- Event :: WindowEvent { event, .. } if adapter. on_event ( & window, & event) => match event {
181- WindowEvent :: CloseRequested => {
182- event_loop. exit ( ) ;
183- }
184- WindowEvent :: KeyboardInput {
185- event :
186- KeyEvent {
187- logical_key : virtual_code,
188- state : ElementState :: Pressed ,
189- ..
190- } ,
191- ..
192- } => match virtual_code {
193- Key :: Named ( winit:: keyboard:: NamedKey :: Tab ) => {
194- let mut state = state. lock ( ) . unwrap ( ) ;
195- let new_focus = if state. focus == BUTTON_1_ID {
196- BUTTON_2_ID
197- } else {
198- BUTTON_1_ID
199- } ;
200- state. set_focus ( & adapter, new_focus) ;
201- }
202- Key :: Named ( winit:: keyboard:: NamedKey :: Space ) => {
203- let mut state = state. lock ( ) . unwrap ( ) ;
204- let id = state. focus ;
205- state. press_button ( & adapter, id) ;
180+ Event :: WindowEvent { event, .. } => {
181+ adapter. process_event ( & window, & event) ;
182+ match event {
183+ WindowEvent :: CloseRequested => {
184+ event_loop. exit ( ) ;
206185 }
186+ WindowEvent :: KeyboardInput {
187+ event :
188+ KeyEvent {
189+ logical_key : virtual_code,
190+ state : ElementState :: Pressed ,
191+ ..
192+ } ,
193+ ..
194+ } => match virtual_code {
195+ Key :: Named ( winit:: keyboard:: NamedKey :: Tab ) => {
196+ let mut state = state. lock ( ) . unwrap ( ) ;
197+ let new_focus = if state. focus == BUTTON_1_ID {
198+ BUTTON_2_ID
199+ } else {
200+ BUTTON_1_ID
201+ } ;
202+ state. set_focus ( & adapter, new_focus) ;
203+ }
204+ Key :: Named ( winit:: keyboard:: NamedKey :: Space ) => {
205+ let mut state = state. lock ( ) . unwrap ( ) ;
206+ let id = state. focus ;
207+ state. press_button ( & adapter, id) ;
208+ }
209+ _ => ( ) ,
210+ } ,
207211 _ => ( ) ,
208- } ,
209- _ => ( ) ,
210- } ,
212+ }
213+ }
211214 Event :: UserEvent ( ActionRequestEvent {
212215 request :
213216 ActionRequest {
0 commit comments