diff options
author | 2023-02-11 03:06:42 +0100 | |
---|---|---|
committer | 2023-02-11 03:06:42 +0100 | |
commit | 9506fb1181e60e78d92b6f0712d385371966e07f (patch) | |
tree | 172c3950cf15630f5fce82c094d7256d86e3057b /winit/src/application.rs | |
parent | 92ba26b8a168b1d58b8330d84753c5ab7e116f17 (diff) | |
download | iced-9506fb1181e60e78d92b6f0712d385371966e07f.tar.gz iced-9506fb1181e60e78d92b6f0712d385371966e07f.tar.bz2 iced-9506fb1181e60e78d92b6f0712d385371966e07f.zip |
Hide window until `Renderer` has been initialized
Diffstat (limited to 'winit/src/application.rs')
-rw-r--r-- | winit/src/application.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/winit/src/application.rs b/winit/src/application.rs index c1836ed9..769fe9dd 100644 --- a/winit/src/application.rs +++ b/winit/src/application.rs @@ -147,11 +147,15 @@ where #[cfg(target_arch = "wasm32")] let target = settings.window.platform_specific.target.clone(); - let builder = settings.window.into_builder( - &application.title(), - event_loop.primary_monitor(), - settings.id, - ); + let should_be_visible = settings.window.visible; + let builder = settings + .window + .into_builder( + &application.title(), + event_loop.primary_monitor(), + settings.id, + ) + .with_visible(false); log::info!("Window builder: {:#?}", builder); @@ -202,6 +206,7 @@ where control_sender, init_command, window, + should_be_visible, settings.exit_on_close_request, ); @@ -268,6 +273,7 @@ async fn run_instance<A, E, C>( mut control_sender: mpsc::UnboundedSender<winit::event_loop::ControlFlow>, init_command: Command<A::Message>, window: winit::window::Window, + should_be_visible: bool, exit_on_close_request: bool, ) where A: Application + 'static, @@ -295,6 +301,10 @@ async fn run_instance<A, E, C>( physical_size.height, ); + if should_be_visible { + window.set_visible(true); + } + run_command( &application, &mut cache, |