[gnome-settings-daemon] Don't try to activate configurations without any 'on' outputs



commit 685245756c3c8655951d237a3cc7a43aeefd5127
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Aug 27 18:14:17 2010 -0400

    Don't try to activate configurations without any 'on' outputs
    
    This can lead to unwanted warning bubbles at login in VMs.
    Bug 628056

 plugins/xrandr/gsd-xrandr-manager.c |   52 +++++++++++++++++++++++++---------
 1 files changed, 38 insertions(+), 14 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 7f66cd2..eafe968 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -553,6 +553,20 @@ print_configuration (GnomeRRConfig *config, const char *header)
                 print_output (config->outputs[i]);
 }
 
+static gboolean
+config_is_all_off (GnomeRRConfig *config)
+{
+        int j;
+
+        for (j = 0; config->outputs[j] != NULL; ++j) {
+                if (config->outputs[j]->on) {
+                        return FALSE;
+                }
+        }
+
+        return TRUE;
+}
+
 static GnomeRRConfig *
 make_clone_setup (GnomeRRScreen *screen)
 {
@@ -602,6 +616,11 @@ make_clone_setup (GnomeRRScreen *screen)
                 }
         }
 
+        if (config_is_all_off (result)) {
+                gnome_rr_config_free (result);
+                result = NULL;
+        }
+
         print_configuration (result, "clone setup");
 
         return result;
@@ -700,6 +719,11 @@ make_laptop_setup (GnomeRRScreen *screen)
                 }
         }
 
+        if (config_is_all_off (result)) {
+                gnome_rr_config_free (result);
+                result = NULL;
+        }
+
         print_configuration (result, "Laptop setup");
 
         /* FIXME - Maybe we should return NULL if there is more than
@@ -743,6 +767,11 @@ make_xinerama_setup (GnomeRRScreen *screen)
                         x = turn_on_and_get_rightmost_offset (screen, info, x);
         }
 
+        if (config_is_all_off (result)) {
+                gnome_rr_config_free (result);
+                result = NULL;
+        }
+
         print_configuration (result, "xinerama setup");
 
         return result;
@@ -770,6 +799,11 @@ make_other_setup (GnomeRRScreen *screen)
                }
         }
 
+        if (config_is_all_off (result)) {
+                gnome_rr_config_free (result);
+                result = NULL;
+        }
+
         print_configuration (result, "other setup");
 
         return result;
@@ -812,20 +846,10 @@ sanitize (GsdXrandrManager *manager, GPtrArray *array)
         for (i = 0; i < array->len; ++i) {
                 GnomeRRConfig *config = array->pdata[i];
 
-                if (config) {
-                        gboolean all_off = TRUE;
-                        int j;
-
-                        for (j = 0; config->outputs[j] != NULL; ++j) {
-                                if (config->outputs[j]->on)
-                                        all_off = FALSE;
-                        }
-
-                        if (all_off) {
-                                g_debug ("removing configuration as all outputs are off");
-                                gnome_rr_config_free (array->pdata[i]);
-                                array->pdata[i] = NULL;
-                        }
+                if (config && config_is_all_off (config)) {
+                        g_debug ("removing configuration as all outputs are off");
+                        gnome_rr_config_free (array->pdata[i]);
+                        array->pdata[i] = NULL;
                 }
         }
 



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