[gnome-settings-daemon] xsettings: Reload the scale factor when mutter starts up



commit c10e1619dee106c0aa231fabd116640f32c8c14b
Author: Rui Matos <tiagomatos gmail com>
Date:   Tue Oct 3 11:58:41 2017 +0200

    xsettings: Reload the scale factor when mutter starts up
    
    We get the scale factor from mutter at start up but mutter might not
    be running yet, particularly on X sessions, leaving us with a fallback
    value. We should reload when mutter's well known name appears which
    also covers the case of a mutter restart.
    
    Based on a patch from Andrea Azzarone <andrea azzarone canonical com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788268

 plugins/xsettings/gsd-xsettings-manager.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/plugins/xsettings/gsd-xsettings-manager.c b/plugins/xsettings/gsd-xsettings-manager.c
index ae5cc1a..d758246 100644
--- a/plugins/xsettings/gsd-xsettings-manager.c
+++ b/plugins/xsettings/gsd-xsettings-manager.c
@@ -276,6 +276,7 @@ struct GnomeXSettingsManagerPrivate
 
         GsdRemoteDisplayManager *remote_display;
 
+        guint              display_config_watch_id;
         guint              monitors_changed_id;
 
         guint              shell_name_watch_id;
@@ -1121,6 +1122,16 @@ on_monitors_changed (GDBusConnection *connection,
         monitors_changed (manager);
 }
 
+static void
+on_display_config_name_appeared_handler (GDBusConnection *connection,
+                                         const gchar     *name,
+                                         const gchar     *name_owner,
+                                         gpointer         data)
+{
+        GnomeXSettingsManager *manager = data;
+        monitors_changed (manager);
+}
+
 gboolean
 gnome_xsettings_manager_start (GnomeXSettingsManager *manager,
                                GError               **error)
@@ -1155,6 +1166,14 @@ gnome_xsettings_manager_start (GnomeXSettingsManager *manager,
                                                     on_monitors_changed,
                                                     manager,
                                                     NULL);
+        manager->priv->display_config_watch_id =
+                g_bus_watch_name_on_connection (manager->priv->dbus_connection,
+                                                "org.gnome.Mutter.DisplayConfig",
+                                                G_BUS_NAME_WATCHER_FLAGS_NONE,
+                                                on_display_config_name_appeared_handler,
+                                                NULL,
+                                                manager,
+                                                NULL);
 
         manager->priv->settings = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                          NULL, (GDestroyNotify) g_object_unref);
@@ -1268,6 +1287,11 @@ gnome_xsettings_manager_stop (GnomeXSettingsManager *manager)
                 p->monitors_changed_id = 0;
         }
 
+        if (p->display_config_watch_id) {
+                g_bus_unwatch_name (p->display_config_watch_id);
+                p->display_config_watch_id = 0;
+        }
+
         if (p->shell_name_watch_id > 0) {
                 g_bus_unwatch_name (p->shell_name_watch_id);
                 p->shell_name_watch_id = 0;


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