diff options
author | Yaakov Selkowitz <yselkowi@redhat.com> | 2015-07-15 00:48:16 -0500 |
---|---|---|
committer | Yaakov Selkowitz <yselkowi@redhat.com> | 2015-07-15 00:58:06 -0500 |
commit | 56d0940c963e8d6a976d8cf650b1d456d145e0b3 (patch) | |
tree | 379d49c8ddf00b8b4d2237a98e1c46a325b71fe3 /metacity-3.14-bgo738562.patch | |
parent | d98d8fbb51477a723f46eff4837b9eaf8cdb8e71 (diff) | |
download | metacity-56d0940c963e8d6a976d8cf650b1d456d145e0b3.tar.gz metacity-56d0940c963e8d6a976d8cf650b1d456d145e0b3.tar.xz metacity-56d0940c963e8d6a976d8cf650b1d456d145e0b3.zip |
Add upstream patch for GNOME bug 738562
Diffstat (limited to 'metacity-3.14-bgo738562.patch')
-rw-r--r-- | metacity-3.14-bgo738562.patch | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/metacity-3.14-bgo738562.patch b/metacity-3.14-bgo738562.patch new file mode 100644 index 0000000..9209612 --- /dev/null +++ b/metacity-3.14-bgo738562.patch @@ -0,0 +1,167 @@ +From 5e694c3935c838bb2d1179d3cbb6da61f433a5c1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts.muktupavels@gmail.com> +Date: Thu, 4 Jun 2015 17:04:51 +0300 +Subject: prefs: use button layout from GtkSettings + +This is needed to make sure that client-side and server-side +decorations have same button layout. + +GNOME Settings Daemon will update Gtk/DecorationLayout from +button-layout. At this point everything should be ok. + +But then it is possible to override Gtk/DecorationLayout from +xsettings plugin in GNOME Settings Daemon. At this point we can +end up with different button layouts between client-side and +server-side decorations. I can not think any reason why someone +would want different button layouts. + +diff --git a/src/core/prefs.c b/src/core/prefs.c +index 6278fdd..f404aff 100644 +--- a/src/core/prefs.c ++++ b/src/core/prefs.c +@@ -129,6 +129,7 @@ static gboolean button_layout_handler (GVariant*, gpointer*, gpointer); + static void init_bindings (void); + static void init_workspace_names (void); + ++static void update_button_layout (const gchar *string_value); + + typedef struct + { +@@ -759,6 +760,71 @@ queue_changed (MetaPreference pref) + changed_idle_handler, NULL, NULL); + } + ++static void ++gtk_decoration_layout_changed (GtkSettings *settings, ++ GParamSpec *pspec, ++ gpointer user_data) ++{ ++ gchar *layout; ++ gchar **sides; ++ gint i; ++ gint j; ++ ++ g_object_get (settings, "gtk-decoration-layout", &layout, NULL); ++ ++ sides = g_strsplit (layout, ":", -1); ++ g_free (layout); ++ ++ for (i = 0; sides[i]; i++) ++ { ++ gchar **buttons; ++ ++ buttons = g_strsplit (sides[i], ",", -1); ++ ++ for (j = 0; buttons[j]; j++) ++ { ++ const gchar *button; ++ ++ if (g_strcmp0 (buttons[j], "icon") == 0) ++ button = "menu"; ++ else if (g_strcmp0 (buttons[j], "menu") == 0) ++ button = "appmenu"; ++ else ++ button = NULL; ++ ++ if (button) ++ { ++ g_free (buttons[j]); ++ buttons[j] = g_strdup (button); ++ } ++ } ++ ++ g_free (sides[i]); ++ sides[i] = g_strjoinv (",", buttons); ++ ++ g_strfreev (buttons); ++ } ++ ++ layout = g_strjoinv (":", sides); ++ g_strfreev (sides); ++ ++ update_button_layout (layout); ++ g_free (layout); ++} ++ ++static void ++init_gtk_decoration_layout (void) ++{ ++ GtkSettings *settings; ++ ++ settings = gtk_settings_get_default (); ++ ++ g_signal_connect (settings, "notify::gtk-decoration-layout", ++ G_CALLBACK (gtk_decoration_layout_changed), NULL); ++ ++ gtk_decoration_layout_changed (settings, NULL, NULL); ++} ++ + /****************************************************************************/ + /* Initialisation. */ + /****************************************************************************/ +@@ -799,6 +865,8 @@ meta_prefs_init (void) + + init_bindings (); + init_workspace_names (); ++ ++ init_gtk_decoration_layout (); + } + + /****************************************************************************/ +@@ -1118,13 +1186,10 @@ button_opposite_function (MetaButtonFunction ofwhat) + } + } + +-static gboolean +-button_layout_handler (GVariant *value, +- gpointer *result, +- gpointer data) ++static void ++update_button_layout (const gchar *string_value) + { + MetaButtonLayout new_layout; +- const gchar *string_value; + char **sides = NULL; + int i; + +@@ -1132,12 +1197,7 @@ button_layout_handler (GVariant *value, + * compat with future versions + */ + +- *result = NULL; /* ignored */ +- string_value = g_variant_get_string (value, NULL); +- +- if (string_value) +- sides = g_strsplit (string_value, ":", 2); +- ++ sides = g_strsplit (string_value, ":", 2); + i = 0; + + if (sides != NULL && sides[0] != NULL) +@@ -1303,7 +1363,23 @@ button_layout_handler (GVariant *value, + button_layout = new_layout; + emit_changed (META_PREF_BUTTON_LAYOUT); + } ++} + ++static gboolean ++button_layout_handler (GVariant *value, ++ gpointer *result, ++ gpointer data) ++{ ++#if 0 ++ const gchar *string_value; ++ ++ string_value = g_variant_get_string (value, NULL); ++ ++ if (string_value) ++ update_button_layout (string_value); ++#endif ++ ++ *result = NULL; /* ignored */ + return TRUE; + } + +-- +cgit v0.10.2 + |