From bd7ba540cfd64cfabdbb7dbf95fae2f695fa24c9 Mon Sep 17 00:00:00 2001 From: Long0x0 <51022287+Long0x0@users.noreply.github.com> Date: Sun, 8 Dec 2024 15:29:21 +0800 Subject: [PATCH] Delay window visibility to prevent white background on app launch (#702) Co-authored-by: Jakub Panek --- src/app_handle.rs | 1 + src/window_handle.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/app_handle.rs b/src/app_handle.rs index 152230a2..8524088e 100644 --- a/src/app_handle.rs +++ b/src/app_handle.rs @@ -301,6 +301,7 @@ impl ApplicationHandle { let logical_size = size.map(|size| LogicalSize::new(size.width, size.height)); let mut window_builder = floem_winit::window::WindowBuilder::new() + .with_visible(false) .with_title(title) .with_decorations(!undecorated) .with_transparent(transparent) diff --git a/src/window_handle.rs b/src/window_handle.rs index 3bf3d428..a97720c1 100644 --- a/src/window_handle.rs +++ b/src/window_handle.rs @@ -197,6 +197,9 @@ impl WindowHandle { } // Now that the renderer is initialized, draw the first frame self.render_frame(); + if let Some(window) = self.window.as_ref() { + window.set_visible(true); + } } pub fn event(&mut self, event: Event) {