From add67b516cb6cbd9b36454d880dd2d7156eced19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 5 Jun 2014 16:34:43 +0200 Subject: [PATCH] wayland: Explicitly handle classic mode for now There are plans to add session-dependent defaults to GSettings (based on the newly standardized XDG_CURRENT_DESKTOP); until then, the WM uses a different schema for its button-layout setting in classic mode. So for the time being, do the same and pick the alternative schema when XDG_CURRENT_DESKTOP indicates that we are in a classic session. (It's not pretty, but hopefully won't be with us for too long ...) https://bugzilla.gnome.org/show_bug.cgi?id=731273 --- gdk/wayland/gdkscreen-wayland.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c index 261ac20167..16b54b86f5 100644 --- a/gdk/wayland/gdkscreen-wayland.c +++ b/gdk/wayland/gdkscreen-wayland.c @@ -482,6 +482,9 @@ update_xft_settings (GdkScreen *screen) } } +#define WM_SETTINGS_SCHEMA "org.gnome.desktop.wm.preferences" +#define CLASSIC_WM_SETTINGS_SCHEMA "org.gnome.shell.extensions.classic-overrides" + typedef struct _TranslationEntry TranslationEntry; struct _TranslationEntry { const gchar *schema; @@ -513,7 +516,8 @@ static TranslationEntry translations[] = { { "org.gnome.desktop.sound", "input-feedback-sounds", "gtk-enable-input-feedback-sounds", G_TYPE_BOOLEAN, { . b = FALSE } }, { "org.gnome.desktop.privacy", "recent-files-max-age", "gtk-recent-files-max-age", G_TYPE_INT, { .i = 30 } }, { "org.gnome.desktop.privacy", "remember-recent-files", "gtk-recent-files-enabled", G_TYPE_BOOLEAN, { .b = TRUE } }, - { "org.gnome.desktop.wm.preferences", "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } }, + { WM_SETTINGS_SCHEMA, "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } }, + { CLASSIC_WM_SETTINGS_SCHEMA, "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } }, { "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 0 } }, { "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 0 } }, { "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 0 } }, @@ -690,9 +694,19 @@ set_decoration_layout_from_entry (GdkScreen *screen, GValue *value) { GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen); - GSettings *settings; + GSettings *settings = NULL; + const char *session; - settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings, entry->schema); + /* Hack: until we get session-dependent defaults in GSettings, + * swap out the usual schema for the "classic" one when + * running in classic mode + */ + session = g_getenv ("XDG_CURRENT_DESKTOP"); + if (session && strstr (session, "GNOME-Classic")) + settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings, CLASSIC_WM_SETTINGS_SCHEMA); + + if (settings == NULL) + settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings, WM_SETTINGS_SCHEMA); if (settings) {