mirror of
https://git.suyu.dev/suyu/flatpak.git
synced 2025-01-06 14:26:07 +00:00
80 lines
2.1 KiB
Diff
80 lines
2.1 KiB
Diff
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
|
|
index 186a8f5cb2..f5c39b5afe 100644
|
|
--- a/gdk/x11/gdkevents-x11.c
|
|
+++ b/gdk/x11/gdkevents-x11.c
|
|
@@ -3000,6 +3000,50 @@ check_transform (const gchar *xsettings_name,
|
|
return TRUE;
|
|
}
|
|
|
|
+static gchar *
|
|
+gtk_rc_get_theme_dir (void)
|
|
+{
|
|
+ const gchar *var;
|
|
+ gchar *path;
|
|
+
|
|
+ var = g_getenv ("GTK_DATA_PREFIX");
|
|
+
|
|
+ if (var)
|
|
+ path = g_build_filename (var, "share", "themes", NULL);
|
|
+ else
|
|
+ path = g_build_filename ("/app", "share", "themes", NULL);
|
|
+
|
|
+ return path;
|
|
+}
|
|
+
|
|
+static gboolean
|
|
+theme_name_valid (XSettingsSetting *setting)
|
|
+{
|
|
+ gboolean res = FALSE;
|
|
+
|
|
+ if (setting->type == XSETTINGS_TYPE_STRING)
|
|
+ {
|
|
+ char *theme_name = setting->data.v_string;
|
|
+ gchar *theme_dir = gtk_rc_get_theme_dir ();
|
|
+ gchar *path = g_build_filename (theme_dir, theme_name, "gtk-2.0", "gtkrc", NULL);
|
|
+
|
|
+ if (g_file_test (path, G_FILE_TEST_EXISTS))
|
|
+ res = TRUE;
|
|
+ else if (g_str_has_suffix (theme_name, "-Dark") ||
|
|
+ g_str_has_suffix (theme_name, "-dark"))
|
|
+ {
|
|
+ setting->data.v_string = g_strdup ("Adwaita-dark");
|
|
+ g_free (theme_name);
|
|
+ res = TRUE;
|
|
+ }
|
|
+
|
|
+ g_free (theme_dir);
|
|
+ g_free (path);
|
|
+ }
|
|
+
|
|
+ return res;
|
|
+}
|
|
+
|
|
/**
|
|
* gdk_screen_get_setting:
|
|
* @screen: the #GdkScreen where the setting is located
|
|
@@ -3050,6 +3094,11 @@ gdk_screen_get_setting (GdkScreen *screen,
|
|
if (result != XSETTINGS_SUCCESS)
|
|
goto out;
|
|
|
|
+ if (strcmp (name, "gtk-theme-name") == 0 &&
|
|
+ (setting->type != XSETTINGS_TYPE_STRING ||
|
|
+ !theme_name_valid (setting)))
|
|
+ goto out;
|
|
+
|
|
switch (setting->type)
|
|
{
|
|
case XSETTINGS_TYPE_INT:
|
|
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
|
|
index 3fbbf00548..5c0a4b33d2 100644
|
|
--- a/gtk/gtksettings.c
|
|
+++ b/gtk/gtksettings.c
|
|
@@ -312,7 +312,7 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
|
#ifdef G_OS_WIN32
|
|
"MS-Windows",
|
|
#else
|
|
- "Raleigh",
|
|
+ "Adwaita",
|
|
#endif
|
|
GTK_PARAM_READWRITE),
|
|
NULL);
|