Launchpad has imported 4 comments from the remote bug at https://bugzilla.xfce.org/show_bug.cgi?id=10717.
If you reply to an imported comment from within Launchpad, your comment will be sent to the remote bug automatically. Read more about Launchpad's inter-bugtracker facilities at https://help.launchpad.net/InterBugTracking. ------------------------------------------------------------------------ On 2014-02-27T19:08:16+00:00 Alistair Buxton wrote: in xfce_randr_populate is this piece of code: /* prepare the temporary cache */ outputs = g_ptr_array_new (); /* walk the outputs */ for (n = 0; n < randr->priv->resources->noutput; ++n) { /* get the output info */ output_info = XRRGetOutputInfo (xdisplay, randr->priv->resources, randr->priv->resources->outputs[n]); /* forget about disconnected outputs */ if (output_info->connection != RR_Connected) { XRRFreeOutputInfo (output_info); continue; } /* cache it */ g_ptr_array_add (outputs, output_info); } /* migrate the temporary cache */ randr->noutput = outputs->len; randr->priv->output_info = (XRROutputInfo **) g_ptr_array_free (outputs, FALSE); This gets the info for each output, and if the output is connected it store the info. Later on is this: /* walk the connected outputs */ for (m = 0; m < randr->noutput; ++m) { ... /* fill in the name used by the UI */ randr->friendly_name[m] = xfce_randr_friendly_name (randr, m); ... } Inside friendly name it eventually does this: edid_data = xfce_randr_read_edid_data (xdisplay, randr->priv->resources->outputs[output]); Here, output = m. This is invalid because m only counts connected outputs, but is being used as an offset into randr->priv->resources->outputs, which includes unconnected outputs. As a result, all the connected monitor names are wrong if you have unconnected displays. Commenting this piece of code fixes the problem: /* forget about disconnected outputs */ if (output_info->connection != RR_Connected) { XRRFreeOutputInfo (output_info); continue; } However, this causes all unconnected outputs to be listed in the display settings (although they are "greyed" indicating they are not connected). Reply at: https://bugs.launchpad.net/ubuntu/+source/xfce4-settings/+bug/1300277/comments/0 ------------------------------------------------------------------------ On 2014-02-27T20:26:53+00:00 Alistair Buxton wrote: So this isn't really a proper fix, but I think it's better than having the output names totally wrong. A proper fix would be to store the actual output number somewhere so that we can index correctly into the full array. Alternatively, check for which outputs are connected when building the gui, instead of when building the cache. Or maybe even don't use the cache at all and always use the randr supplied data as-is. Reply at: https://bugs.launchpad.net/ubuntu/+source/xfce4-settings/+bug/1300277/comments/1 ------------------------------------------------------------------------ On 2014-02-27T20:28:14+00:00 Alistair Buxton wrote: Oh and one other thing: the wrong indexing might be getting used in other parts of the code: I have not checked this, but someone should take a look. The wrong monitor names are just the most obvious visible side effect. Reply at: https://bugs.launchpad.net/ubuntu/+source/xfce4-settings/+bug/1300277/comments/2 ------------------------------------------------------------------------ On 2014-02-27T22:11:30+00:00 Lionel Le Folgoc wrote: Thanks for your bug report. I guess that's easy to miss when you only have two outputs when you code. ;-) The wrong index is only used one more time, at the beginning of the loop: > /* find the primary screen if supported */ > if (randr->priv->has_1_3 && XRRGetOutputPrimary (xdisplay, > GDK_WINDOW_XID (root_window)) == randr->priv->resources->outputs[m]) (basically any access to randr->priv->resources->outputs) I don't remember why I used a GPtrArray (I did that too long ago), probably because it's auto-expanding and g_ptr_array_free() returns an array, which was what I needed. But that was probably overkill anyway. As you wrote, the least intrusive fix (probably better for Xubuntu at this time) is to store the connected RROutputs in a small array during the first loop, so they have the same index as randr->priv->output_info, and so you can replace the two uses of randr->priv->resources->outputs[m] with that_array[m]. And it can be destroyed after the second loop. Anyway, YMMV. Another possible fix is to drop the temporary cache and allocate arrays of randr->priv->resources->noutput elements. There will be a few unused elements at the end (randr->priv->resources->noutput - randr->noutput), but it's small and we probably don't care. Reply at: https://bugs.launchpad.net/ubuntu/+source/xfce4-settings/+bug/1300277/comments/3 ** Changed in: xfce4-settings Status: Unknown => Confirmed ** Changed in: xfce4-settings Importance: Unknown => Medium -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1300277 Title: monitor names incorrect in dual monitor setup To manage notifications about this bug go to: https://bugs.launchpad.net/xfce4-settings/+bug/1300277/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs