[gtk+] wayland: Explicitly handle classic mode for now



commit add67b516cb6cbd9b36454d880dd2d7156eced19
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jun 5 16:34:43 2014 +0200

    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 |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 261ac20..16b54b8 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;
-
-  settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings, entry->schema);
+  GSettings *settings = NULL;
+  const char *session;
+
+  /* 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)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]