[gnome-settings-daemon/gnome-3-2] color: Correctly set the _ICC_PROFILE when there is no primary device specified



commit 5f6c3a3999bd5196ef0ee8f2c1fa5c2d4acb8ddb
Author: Richard Hughes <richard hughsie com>
Date:   Mon Feb 20 09:27:56 2012 +0000

    color: Correctly set the _ICC_PROFILE when there is no primary device specified
    
    When there is no primary or laptop display, fall back to the first *connected*
    display, not just the first display returned from xrandr.
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=670368

 plugins/color/gsd-color-manager.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/color/gsd-color-manager.c b/plugins/color/gsd-color-manager.c
index c59ea88..46dc0a0 100644
--- a/plugins/color/gsd-color-manager.c
+++ b/plugins/color/gsd-color-manager.c
@@ -969,6 +969,7 @@ gcm_session_use_output_profile_for_screen (GsdColorManager *manager,
         gboolean has_laptop = FALSE;
         gboolean has_primary = FALSE;
         GnomeRROutput **outputs;
+        GnomeRROutput *connected = NULL;
         guint i;
 
         /* do we have any screens marked as primary */
@@ -980,6 +981,8 @@ gcm_session_use_output_profile_for_screen (GsdColorManager *manager,
         for (i = 0; outputs[i] != NULL; i++) {
                 if (!gnome_rr_output_is_connected (outputs[i]))
                         continue;
+                if (connected == NULL)
+                        connected = outputs[i];
                 if (gnome_rr_output_get_is_primary (outputs[i]))
                         has_primary = TRUE;
                 if (gnome_rr_output_is_laptop (outputs[i]))
@@ -994,8 +997,11 @@ gcm_session_use_output_profile_for_screen (GsdColorManager *manager,
         if (has_laptop)
                 return gnome_rr_output_is_laptop (output);
 
-        /* we have to choose one, so go for the first listed device */
-        return gnome_rr_output_get_id (outputs[0]) == gnome_rr_output_get_id (output);
+        /* we have to choose one, so go for the first connected device */
+        if (connected != NULL)
+                return gnome_rr_output_get_id (connected) == gnome_rr_output_get_id (output);
+
+        return FALSE;
 }
 
 static void



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