diff --git a/winit/src/application.rs b/winit/src/application.rs index c1836ed9fb..769fe9ddbe 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( mut control_sender: mpsc::UnboundedSender, init_command: Command, 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( physical_size.height, ); + if should_be_visible { + window.set_visible(true); + } + run_command( &application, &mut cache, diff --git a/winit/src/settings.rs b/winit/src/settings.rs index 9bbdef5cea..45f388337d 100644 --- a/winit/src/settings.rs +++ b/winit/src/settings.rs @@ -114,8 +114,7 @@ impl Window { .with_decorations(self.decorations) .with_transparent(self.transparent) .with_window_icon(self.icon) - .with_always_on_top(self.always_on_top) - .with_visible(self.visible); + .with_always_on_top(self.always_on_top); if let Some(position) = conversion::position( primary_monitor.as_ref(),