From 3c2c2afc875dcb8d5ee1fe8489fec19ee1b801aa Mon Sep 17 00:00:00 2001 From: Simon Steinbeiss Date: Mon, 19 Aug 2019 18:11:31 +0200 Subject: [PATCH 2/2] display: Fix profile matching in xfsettingsd Previously the code (erroneously) checked the CRTCs instead of the Outputs, which meant that sometimes no EDID would be found (which is to be expected). Also the amount of CRTCs doesn't match the number of Outputs (the two are completely different things) so the for loop was all wrong. --- xfsettingsd/displays.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xfsettingsd/displays.c b/xfsettingsd/displays.c index 289ff206..2efefa8e 100644 --- a/xfsettingsd/displays.c +++ b/xfsettingsd/displays.c @@ -436,9 +436,9 @@ xfce_displays_helper_reload (XfceDisplaysHelper *helper) static gchar ** -xfce_displays_helper_get_display_infos (gint noutput, - Display *xdisplay, - RROutput *outputs) +xfce_displays_helper_get_display_infos (gint noutput, + Display *xdisplay, + GPtrArray *outputs) { gchar **display_infos; gint m; @@ -448,7 +448,10 @@ xfce_displays_helper_get_display_infos (gint noutput, /* get all display edids, to only query randr once */ for (m = 0; m < noutput; ++m) { - edid_data = xfce_randr_read_edid_data (xdisplay, outputs[m]); + XfceRROutput *output; + + output = g_ptr_array_index (outputs, m); + edid_data = xfce_randr_read_edid_data (xdisplay, output->id); if (edid_data) display_infos[m] = g_compute_checksum_for_data (G_CHECKSUM_SHA1 , edid_data, 128); @@ -470,9 +473,9 @@ xfce_displays_helper_get_matching_profile (XfceDisplaysHelper *helper) gchar *property; gchar **display_infos; - display_infos = xfce_displays_helper_get_display_infos (helper->resources->noutput, + display_infos = xfce_displays_helper_get_display_infos (helper->outputs->len, helper->xdisplay, - helper->resources->outputs); + helper->outputs); if (display_infos) { profiles = display_settings_get_profiles (display_infos, helper->channel); -- 2.19.1