From 9ef607f44a891749a8f0d231877faabb45932797 Mon Sep 17 00:00:00 2001 From: deepend Date: Thu, 26 Feb 2026 08:58:38 -0700 Subject: [PATCH] Fixed GTK3 theme switching on Win32 so fallback window CSS is synchronized immediately when switching back to the system theme (theme_name == NULL) by calling fe_apply_windows_theme(dark) in that path before provider cleanup. Fixed GTK3 theme activation on Win32 so fallback window CSS is disabled immediately after loading an imported GTK3 theme, preventing mixed styling (like unthemed buttons/chat areas) during runtime theme changes --- src/fe-gtk/fe-gtk.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 85f145f4..d4b16a73 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -756,6 +756,12 @@ fe_apply_gtk3_theme_with_reload (const char *theme_name, gboolean force_reload, if (!theme_name || !*theme_name) { + #ifdef G_OS_WIN32 + /* Keep the Win32 fallback provider in sync when returning to the + * system theme from Preferences > Themes. */ + fe_apply_windows_theme (dark); + #endif + if (gtk3_theme_provider && screen) { gtk_style_context_remove_provider_for_screen ( @@ -842,6 +848,12 @@ fe_apply_gtk3_theme_with_reload (const char *theme_name, gboolean force_reload, gtk_style_context_reset_widgets (screen); } +#ifdef G_OS_WIN32 + /* Applying a GTK3 theme should immediately disable ZoiteChat's Win32 + * fallback window CSS so buttons/chat widgets are fully theme-driven. */ + fe_apply_windows_theme (dark); +#endif + g_free (gtk3_theme_provider_name); gtk3_theme_provider_name = g_strdup (theme_name); gtk3_theme_provider_dark = dark;