From 04f53b5f624cbe00bad2cb719bb7cb9a45ab1a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Wed, 10 Sep 2025 18:08:01 +0200 Subject: [PATCH] Broadcast potential theme changes on window creation --- winit/src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/winit/src/lib.rs b/winit/src/lib.rs index 90a4529b..4b7f02bd 100644 --- a/winit/src/lib.rs +++ b/winit/src/lib.rs @@ -647,6 +647,20 @@ async fn run_instance

( system_theme, ); + let window_theme = window + .raw + .theme() + .map(conversion::theme_mode) + .unwrap_or_default(); + + if system_theme != window_theme { + system_theme = window_theme; + + runtime.broadcast(subscription::Event::SystemThemeChanged( + window_theme, + )); + } + window.raw.set_theme(conversion::window_theme( window.state.theme_mode(), ));