diff --git a/winit/src/program.rs b/winit/src/program.rs index 872c8a98..286fff77 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -650,7 +650,7 @@ async fn run_instance
( } = boot.try_recv().ok().flatten().expect("Receive boot"); let mut window_manager = WindowManager::new(); - let mut boot_window_closed = false; + let mut is_window_opening = !is_daemon; let mut events = Vec::new(); let mut messages = Vec::new(); @@ -706,6 +706,7 @@ async fn run_instance
( )); let _ = on_open.send(id); + is_window_opening = false; } Event::EventLoopAwakened(event) => { match event { @@ -742,6 +743,7 @@ async fn run_instance
( &mut user_interfaces, &mut window_manager, &mut ui_caches, + &mut is_window_opening, ); actions += 1; } @@ -926,16 +928,14 @@ async fn run_instance
( window_event, winit::event::WindowEvent::Destroyed ) + && !is_window_opening + && window_manager.is_empty() { - if boot_window_closed && window_manager.is_empty() { - control_sender - .start_send(Control::Exit) - .expect("Send control action"); + control_sender + .start_send(Control::Exit) + .expect("Send control action"); - continue; - } - - boot_window_closed = true; + continue; } let Some((id, window)) = @@ -1153,6 +1153,7 @@ fn run_action
( >, window_manager: &mut WindowManager
,
ui_caches: &mut FxHashMap (
on_open: channel,
})
.expect("Send control action");
+
+ *is_window_opening = true;
}
window::Action::Close(id) => {
let _ = window_manager.remove(id);