From 888046acedc6e721fb28d4ae96da4e41adc82304 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 15 Jul 2015 00:48:16 -0500 Subject: Add upstream patch for GNOME bug 738562 --- metacity-3.14-bgo738562.patch | 167 ++++++++++++++++++++++++++++++++++++++++++ metacity.spec | 7 +- 2 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 metacity-3.14-bgo738562.patch 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?= +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 + diff --git a/metacity.spec b/metacity.spec index afea4fe..d9f9cf5 100644 --- a/metacity.spec +++ b/metacity.spec @@ -1,7 +1,7 @@ Summary: Unobtrusive window manager Name: metacity Version: 3.16.1 -Release: 1%{?dist} +Release: 2%{?dist} URL: http://download.gnome.org/sources/metacity/ Source0: http://download.gnome.org/sources/metacity/3.16/metacity-%{version}.tar.xz # http://bugzilla.gnome.org/show_bug.cgi?id=558723 @@ -11,6 +11,7 @@ Patch4: stop-spamming-xsession-errors.patch #Patch16: Dont-focus-ancestor-window-on-a-different-workspac.patch # https://bugzilla.gnome.org/show_bug.cgi?id=559816 Patch24: metacity-2.28-empty-keybindings.patch +Patch25: metacity-3.14-bgo738562.patch License: GPLv2+ Group: User Interface/Desktops @@ -67,6 +68,7 @@ API. This package exists purely for technical reasons. #patch16 -p1 -b .focus-different-workspace %patch24 -p1 -b .empty-keybindings +%patch25 -p1 -b .bgo738562 # force regeneration rm -f src/org.gnome.metacity.gschema.valid @@ -144,6 +146,9 @@ fi %{_mandir}/man1/metacity-window-demo.1.gz %changelog +* Wed Jul 15 2015 Yaakov Selkowitz - 3.16.1-2 +- Add upstream patch for GNOME bug 738562 + * Thu Apr 30 2015 Mike DePaulo - 3.16.1-1 - Upgrade to 3.16.1 - Drop metacity-3.14-bgo605678.patch because it was upstreamed -- cgit