[Spice-devel] [PATCH spice-gtk 1/2] channel-display: Make monitors array contain monitors in id order

Marc-André Lureau mlureau at redhat.com
Wed Jan 16 06:07:01 PST 2013



----- Mensaje original -----
> Both the spice-widget code, as well as remote-viewer expect that
> monitors[i]->id == i, but if ie only the qxl-0 and qxl-2 outputs are
> enabled this is not true.
> 
> I've chosen to fix this by making this assumption true. This does
> mean

Your explanation is misleading, we don't know what monitors[] you are talking about. There is no such "expectation" in the code, ie nothing bad will happen:

For spice-gtk, the SpiceDisplay monitor_id is an index to the SpiceDisplayChannel:monitors. It doesn't look for the matching SpiceDisplayMonitorConfig->id.

Regarding virt-viewer, it builds a new "sparse" array:

    g_ptr_array_set_size(displays, monitors_max);

    for (i = 0; i < monitors_max; i++) {
        display = g_ptr_array_index(displays, i);
        if (display == NULL) {
            display = virt_viewer_display_spice_new(self, channel, i);

So this time, and only there, monitors[i]->id == i.

There is no rule about monitor id and disabled monitor handling on the VDAgentMonitorsConfig, and the matching agent behaviour implementation, which you are changing in the following patch.

> that the monitors array can now contain 0x0 sized (iow disabled)
> monitors,
> remote-viewer already checks for this.

Yes, because it builds its own array.

> Thus this patch:
> 1) Makes the monitors[i]->id == i assumption be true

No need for changing that.

> 2) Makes spice-widget check for 0x0 sized monitors and treat them as
> disabled

Nor that.

Nack.


More information about the Spice-devel mailing list