From a93bed2c4150a3273f47b1f56589fffc3184ec8d Mon Sep 17 00:00:00 2001 From: deepend Date: Thu, 26 Feb 2026 08:41:52 -0700 Subject: [PATCH] =?UTF-8?q?Adjusted=20the=20Windows=20theme=20fallback=20p?= =?UTF-8?q?ath=20so=20it=20does=20not=20apply=20ZoiteChat=E2=80=99s=20fall?= =?UTF-8?q?back=20window-color=20CSS=20when=20a=20GTK3=20theme=20is=20sele?= =?UTF-8?q?cted,=20preventing=20the=20mixed-theme=20effect=20you=20reporte?= =?UTF-8?q?d=20(e.g.,=20mismatched=20button/chat=20window=20colors).=20Add?= =?UTF-8?q?ed=20cleanup=20for=20previously-added=20fallback=20CSS=20provid?= =?UTF-8?q?ers=20(with=20widget=20style=20reset)=20when=20a=20GTK3=20theme?= =?UTF-8?q?=20is=20active,=20so=20the=20imported=20theme=20can=20fully=20c?= =?UTF-8?q?ontrol=20styling=20consistently.=20Kept=20the=20original=20Wind?= =?UTF-8?q?ows=20fallback=20CSS=20behavior=20for=20cases=20where=20no=20im?= =?UTF-8?q?ported=20GTK3=20theme=20is=20set,=20so=20non-GTK3-theme=20behav?= =?UTF-8?q?ior=20remains=20unchanged.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fe-gtk/fe-gtk.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c index 02c34712..85f145f4 100644 --- a/src/fe-gtk/fe-gtk.c +++ b/src/fe-gtk/fe-gtk.c @@ -907,14 +907,33 @@ fe_append_window_theme_class_css (GString *css, static void fe_apply_windows_theme (gboolean dark) { + static GtkCssProvider *win_theme_provider = NULL; fe_set_gtk_prefer_dark_theme (dark); { - static GtkCssProvider *win_theme_provider = NULL; GdkScreen *screen = gdk_screen_get_default (); const PaletteColor *light_palette = palette_user_colors (); const PaletteColor *dark_palette = palette_dark_colors (); - GString *css = g_string_new (NULL); + GString *css; + + /* Let imported GTK3 themes own all widget/window colors on Windows. + * Otherwise ZoiteChat's fallback dark/light window background CSS can + * clash with theme widget colors (for example white buttons on a dark + * window background). + */ + if (prefs.hex_gui_gtk3_theme_name[0] != '\0') + { + if (win_theme_provider && screen) + { + gtk_style_context_remove_provider_for_screen ( + screen, + GTK_STYLE_PROVIDER (win_theme_provider)); + gtk_style_context_reset_widgets (screen); + } + return; + } + + css = g_string_new (NULL); if (!win_theme_provider) win_theme_provider = gtk_css_provider_new ();