mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 07:50:19 +00:00
Refactored fe_system_prefers_dark() to always allow gtk-application-prefer-dark-theme to be read as a fallback (when no explicit theme name is set), removing the previous suppression tied to app-written state. This preserves priority for explicit dark theme names and platform-native preference checks before the GTK property fallback.
Added a short in-code comment explaining why app-written GTK property state must not permanently block future reads in AUTO mode. Removed the now-unneeded app_set_prefer_dark tracking behavior from fe_set_gtk_prefer_dark_theme(), so writes no longer disable later fallback reads. Confirmed fe_auto_dark_mode_changed() still prevents reapply loops by early-returning when enabled == auto_dark_mode_enabled before calling theme/apply logic.
This commit is contained in:
@@ -533,8 +533,6 @@ fe_win32_apply_native_titlebar (GtkWidget *window, gboolean dark_mode)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static gboolean app_set_prefer_dark = FALSE;
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fe_system_prefers_dark (void)
|
fe_system_prefers_dark (void)
|
||||||
{
|
{
|
||||||
@@ -573,10 +571,11 @@ fe_system_prefers_dark (void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!has_theme_name
|
if (!has_theme_name
|
||||||
&& !app_set_prefer_dark
|
|
||||||
&& g_object_class_find_property (G_OBJECT_GET_CLASS (settings),
|
&& g_object_class_find_property (G_OBJECT_GET_CLASS (settings),
|
||||||
"gtk-application-prefer-dark-theme"))
|
"gtk-application-prefer-dark-theme"))
|
||||||
{
|
{
|
||||||
|
/* Even if we last wrote this property, the toolkit or desktop can update
|
||||||
|
* it later, so AUTO mode should keep reading it as a fallback signal. */
|
||||||
g_object_get (settings, "gtk-application-prefer-dark-theme", &prefer_dark, NULL);
|
g_object_get (settings, "gtk-application-prefer-dark-theme", &prefer_dark, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,7 +593,6 @@ fe_set_gtk_prefer_dark_theme (gboolean dark)
|
|||||||
"gtk-application-prefer-dark-theme"))
|
"gtk-application-prefer-dark-theme"))
|
||||||
{
|
{
|
||||||
g_object_set (settings, "gtk-application-prefer-dark-theme", dark, NULL);
|
g_object_set (settings, "gtk-application-prefer-dark-theme", dark, NULL);
|
||||||
app_set_prefer_dark = TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user