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



commit cebcc9b605322d6db3dc6bf5c3353f0d7cd7cb2e
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 ce70fd0..870878b 100644
--- a/plugins/common/gsd-device-mapper.c
+++ b/plugins/common/gsd-device-mapper.c
@@ -369,25 +369,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]