// TODO: winit eventloop-2.0 is eating events right now
winit eventloop-2.0 is eating events right now
winit eventloop - 2 . 0 is eating events right now
fn recreate_after_resize() {
    skip_if_no_display!();
    #[cfg(target_os = "linux")]
    let _guard = LOCK.lock().unwrap();
    vki::validate(|| {
        let (mut event_loop, window) = support::headless_window()?;
        let (instance, _adapter, device, surface, mut swapchain) = support::init_with_window(&window)?;
        let queue = device.get_queue();
        let frame = swapchain.acquire_next_image()?;
        queue.present(frame)?;
        let new_size = LogicalSize::<f32> {
            width: 800 as _,
            height: 600 as _,
        };
        let old_size = window.inner_size().to_logical(window.scale_factor());
        assert_ne!(new_size, old_size);
        let mut resized = false;
        window.set_inner_size(new_size);
        event_loop.run_return(|event, _target, control_flow| match event {
            Event::WindowEvent {
                event: WindowEvent::Resized(_),
                ..
            } => {
                let swapchain_descriptor = support::swapchain_descriptor(&surface);
                swapchain = device
                    .create_swapchain(swapchain_descriptor, Some(&swapchain))
                    .expect("Failed to re-create swapchain");
                resized = true;
            }
            Event::MainEventsCleared => *control_flow = ControlFlow::Exit,
            _ => {}
        });
        assert_eq!(true, resized);
        let frame = swapchain.acquire_next_image()?;
        queue.present(frame)?;
        Ok(instance)
    });
}
fn recreate_after_resize ( ) { skip_if_no_display ! ( ) ; # [ cfg ( target_os " " ) ] let _guard = LOCK . lock ( ) . unwrap ( ) ; vki :: validate ( | | { let ( mut event_loop , window ) = support :: headless_window ( ) ? ; let ( instance , _adapter , device , surface , mut swapchain ) = support :: init_with_window ( & window ) ? ; let queue = device . get_queue ( ) ; let frame = swapchain . acquire_next_image ( ) ? ; queue . present ( frame ) ? ; let new_size = LogicalSize :: < f32 > { width : 800 as _ , height : 600 as _ , } ; let old_size = window . inner_size ( ) . to_logical ( window . scale_factor ( ) ) ; assert_ne ! ( new_size old_size ) ; let mut resized = false ; window . set_inner_size ( new_size ) ; event_loop . run_return ( | event , _target , control_flow | match event { Event :: WindowEvent { event : WindowEvent :: Resized ( _ ) , .. } => { let swapchain_descriptor = support :: swapchain_descriptor ( & surface ) ; swapchain = device . create_swapchain ( swapchain_descriptor , Some ( & swapchain ) ) . expect ( " " ) ; resized = true ; } Event :: MainEventsCleared => * control_flow = ControlFlow :: Exit , _ => { } } ) ; assert_eq ! ( true resized ) ; let frame = swapchain . acquire_next_image ( ) ? ; queue . present ( frame ) ? ; Ok ( instance ) } ) ; }
TODO: winit eventloop-2.0 is eating events right now
TODO : winit eventloop - 2 . 0 is eating events right now