From b87757c5521cef9cae0b73c671398ed33f37de59 Mon Sep 17 00:00:00 2001 From: Markus Siglreithmaier Date: Thu, 12 Aug 2021 18:57:07 +0200 Subject: [PATCH] Fix Window visibility regression (#1994) On Windows, set windows visible on init before position update Ensure that the style change is correctly applied, triggering the necessary events. --- src/platform_impl/windows/window.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs index 0a866eb971..c8a00f50f4 100644 --- a/src/platform_impl/windows/window.rs +++ b/src/platform_impl/windows/window.rs @@ -882,6 +882,10 @@ unsafe fn post_init( thread_executor: event_loop.create_thread_executor(), }; + // Set visible before setting the size to ensure the + // attribute is correctly applied. + win.set_visible(attributes.visible); + let dimensions = attributes .inner_size .unwrap_or_else(|| PhysicalSize::new(800, 600).into()); @@ -891,7 +895,6 @@ unsafe fn post_init( // `Window::set_inner_size` changes MAXIMIZED to false. win.set_maximized(true); } - win.set_visible(attributes.visible); if let Some(_) = attributes.fullscreen { win.set_fullscreen(attributes.fullscreen);