[gnome-settings-daemon] xrandr: use default-monitors-setup for autoconfigure



commit 32f7a938fca072e14bad1928b492e29ba0e3090c
Author: Paolo Bonzini <pbonzini redhat com>
Date:   Wed Dec 19 15:37:03 2012 +0100

    xrandr: use default-monitors-setup for autoconfigure
    
    Despite the name, the "default-monitors-setup" key is only used at
    boot time.  After hot-plug of an external monitor, the "xinerama" setup
    is always used.  This patch fixes this so that the default applies
    in the same way for hot- and cold-plug.
    
    Signed-off-by: Paolo Bonzini <pbonzini redhat com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=690500

 plugins/xrandr/gsd-xrandr-manager.c |   58 ++++++++++++++++++++++------------
 1 files changed, 37 insertions(+), 21 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 96de67d..4012933 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -1689,15 +1689,47 @@ out:
         g_object_unref (current);
 }
 
+static GnomeRRConfig *
+make_default_setup (GsdXrandrManager *manager)
+{
+        GsdXrandrManagerPrivate *priv = manager->priv;
+        GnomeRRConfig *config;
+        GsdXrandrBootBehaviour boot;
+
+        boot = g_settings_get_enum (priv->settings, CONF_KEY_DEFAULT_MONITORS_SETUP);
+        g_debug ("xrandr default monitors setup: %d\n", boot);
+
+        switch (boot) {
+        case GSD_XRANDR_BOOT_BEHAVIOUR_DO_NOTHING:
+                config = make_xinerama_setup (manager, priv->rw_screen);
+                break;
+        case GSD_XRANDR_BOOT_BEHAVIOUR_FOLLOW_LID:
+                if (laptop_lid_is_closed (manager))
+                        config = make_other_setup (priv->rw_screen);
+                else
+                        config = make_xinerama_setup (manager, priv->rw_screen);
+                break;
+        case GSD_XRANDR_BOOT_BEHAVIOUR_CLONE:
+                config = make_clone_setup (manager, priv->rw_screen);
+                break;
+        case GSD_XRANDR_BOOT_BEHAVIOUR_DOCK:
+                config = make_other_setup (priv->rw_screen);
+                break;
+        default:
+                g_assert_not_reached ();
+        }
+
+        return config;
+}
+
 static void
 auto_configure_outputs (GsdXrandrManager *manager, guint32 timestamp)
 {
-        GsdXrandrManagerPrivate *priv = manager->priv;
         GnomeRRConfig *config;
 
-        config = make_xinerama_setup (manager, priv->rw_screen);
+        g_debug ("xrandr auto-configure\n");
+        config = make_default_setup (manager);
         if (config) {
-                print_configuration (config, "auto-configure - xinerama mode");
                 apply_configuration (manager, config, timestamp, TRUE, FALSE);
                 g_object_unref (config);
         } else {
@@ -1868,31 +1900,15 @@ static void
 apply_default_boot_configuration (GsdXrandrManager *mgr, guint32 timestamp)
 {
         GsdXrandrManagerPrivate *priv = mgr->priv;
-        GnomeRRScreen *screen = priv->rw_screen;
         GnomeRRConfig *config;
         GsdXrandrBootBehaviour boot;
 
         boot = g_settings_get_enum (priv->settings, CONF_KEY_DEFAULT_MONITORS_SETUP);
 
-        switch (boot) {
-        case GSD_XRANDR_BOOT_BEHAVIOUR_DO_NOTHING:
+        if (boot == GSD_XRANDR_BOOT_BEHAVIOUR_DO_NOTHING)
                 return;
-        case GSD_XRANDR_BOOT_BEHAVIOUR_FOLLOW_LID:
-                if (laptop_lid_is_closed (mgr))
-                        config = make_other_setup (screen);
-                else
-                        config = make_xinerama_setup (mgr, screen);
-                break;
-        case GSD_XRANDR_BOOT_BEHAVIOUR_CLONE:
-                config = make_clone_setup (mgr, screen);
-                break;
-        case GSD_XRANDR_BOOT_BEHAVIOUR_DOCK:
-                config = make_other_setup (screen);
-                break;
-        default:
-                g_assert_not_reached ();
-        }
 
+        config = make_default_setup (mgr);
         if (config) {
                 /* We don't save the configuration (the "false" parameter to the following function) because we don't want to
                  * install a user-side setting when *here* we are using a system-default setting.



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