Merge pull request #1698 from iced-rs/hide-window-until-ready
Hide window until `Renderer` has been initialized
This commit is contained in:
commit
4e93ae8e32
2 changed files with 16 additions and 7 deletions
|
|
@ -147,11 +147,15 @@ where
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
let target = settings.window.platform_specific.target.clone();
|
let target = settings.window.platform_specific.target.clone();
|
||||||
|
|
||||||
let builder = settings.window.into_builder(
|
let should_be_visible = settings.window.visible;
|
||||||
&application.title(),
|
let builder = settings
|
||||||
event_loop.primary_monitor(),
|
.window
|
||||||
settings.id,
|
.into_builder(
|
||||||
);
|
&application.title(),
|
||||||
|
event_loop.primary_monitor(),
|
||||||
|
settings.id,
|
||||||
|
)
|
||||||
|
.with_visible(false);
|
||||||
|
|
||||||
log::info!("Window builder: {:#?}", builder);
|
log::info!("Window builder: {:#?}", builder);
|
||||||
|
|
||||||
|
|
@ -202,6 +206,7 @@ where
|
||||||
control_sender,
|
control_sender,
|
||||||
init_command,
|
init_command,
|
||||||
window,
|
window,
|
||||||
|
should_be_visible,
|
||||||
settings.exit_on_close_request,
|
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>,
|
mut control_sender: mpsc::UnboundedSender<winit::event_loop::ControlFlow>,
|
||||||
init_command: Command<A::Message>,
|
init_command: Command<A::Message>,
|
||||||
window: winit::window::Window,
|
window: winit::window::Window,
|
||||||
|
should_be_visible: bool,
|
||||||
exit_on_close_request: bool,
|
exit_on_close_request: bool,
|
||||||
) where
|
) where
|
||||||
A: Application + 'static,
|
A: Application + 'static,
|
||||||
|
|
@ -295,6 +301,10 @@ async fn run_instance<A, E, C>(
|
||||||
physical_size.height,
|
physical_size.height,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if should_be_visible {
|
||||||
|
window.set_visible(true);
|
||||||
|
}
|
||||||
|
|
||||||
run_command(
|
run_command(
|
||||||
&application,
|
&application,
|
||||||
&mut cache,
|
&mut cache,
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,7 @@ impl Window {
|
||||||
.with_decorations(self.decorations)
|
.with_decorations(self.decorations)
|
||||||
.with_transparent(self.transparent)
|
.with_transparent(self.transparent)
|
||||||
.with_window_icon(self.icon)
|
.with_window_icon(self.icon)
|
||||||
.with_always_on_top(self.always_on_top)
|
.with_always_on_top(self.always_on_top);
|
||||||
.with_visible(self.visible);
|
|
||||||
|
|
||||||
if let Some(position) = conversion::position(
|
if let Some(position) = conversion::position(
|
||||||
primary_monitor.as_ref(),
|
primary_monitor.as_ref(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue