[gnome-settings-daemon/gnome-3-14] device-mapper: Reset the "display" setting on NULL outputs



commit f69893872bfbc5517b83f710c12b28c7251b44c5
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue May 26 14:53:02 2015 +0200

    device-mapper: Reset the "display" setting on NULL outputs
    
    We used to attempt to reconstruct the ['','',''] default, although
    this failed on NULL outputs as we tried to feed NULLs into "as"
    variants/settings.
    
    Fix this by just resetting the key when the device gets a NULL
    output, we can also make the other path clearer as we can't get
    NULLs in edid[] as we previously might.
    
    Based on a patch by Alexandre Rostovtsev <tetromino gentoo org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749844

 plugins/common/gsd-device-mapper.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/plugins/common/gsd-device-mapper.c b/plugins/common/gsd-device-mapper.c
index 41cd0f5..c2e9426 100644
--- a/plugins/common/gsd-device-mapper.c
+++ b/plugins/common/gsd-device-mapper.c
@@ -436,25 +436,28 @@ settings_set_display (GSettings       *settings,
        GVariant *value;
        gsize nvalues;
 
-       prev = g_settings_get_strv (settings, KEY_DISPLAY);
-       nvalues = g_strv_length (prev);
+       if (output) {
+               prev = g_settings_get_strv (settings, KEY_DISPLAY);
+               nvalues = g_strv_length (prev);
 
-       if (output)
                gnome_rr_output_get_ids_from_edid (output, &edid[0],
                                                   &edid[1], &edid[2]);
 
-       if (nvalues != 3 ||
-           g_strcmp0 (prev[0], edid[0]) != 0 ||
-           g_strcmp0 (prev[1], edid[1]) != 0 ||
-           g_strcmp0 (prev[2], edid[2]) != 0) {
-               value = g_variant_new_strv ((const gchar * const *) &edid, 3);
-               g_settings_set_value (settings, KEY_DISPLAY, value);
-       }
+               if (nvalues != 3 ||
+                   strcmp (prev[0], edid[0]) != 0 ||
+                   strcmp (prev[1], edid[1]) != 0 ||
+                   strcmp (prev[2], edid[2]) != 0) {
+                       value = g_variant_new_strv ((const gchar * const *) &edid, 3);
+                       g_settings_set_value (settings, KEY_DISPLAY, value);
+               }
 
-       g_free (edid[0]);
-       g_free (edid[1]);
-       g_free (edid[2]);
-       g_strfreev (prev);
+               g_free (edid[0]);
+               g_free (edid[1]);
+               g_free (edid[2]);
+               g_strfreev (prev);
+       } else {
+               g_settings_reset (settings, KEY_DISPLAY);
+       }
 }
 
 static void


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