[virt-tools-list] [PATCH] Do all display alignment in virt-viewer

Jonathon Jongsma jjongsma at redhat.com
Mon Nov 4 18:06:16 UTC 2013

----- Original Message -----
> From: "Marc-André Lureau" <marcandre.lureau at gmail.com>
> To: "Jonathon Jongsma" <jjongsma at redhat.com>
> Cc: "virt" <virt-tools-list at redhat.com>
> Sent: Sunday, November 3, 2013 9:42:55 AM
> Subject: Re: [virt-tools-list] [PATCH] Do all display alignment in virt-viewer
> On Thu, Oct 31, 2013 at 11:28 PM, Jonathon Jongsma <jjongsma at redhat.com>
> wrote:
> > +    /* sort by distance from origin */
> I wonder why it's sorted by distance (in spice-gtk too). Wouldn't a
> sort by x (then y) be more intuitive?

I suspect that would probably be more intuitive, but I opted to maintain the same behavior for this patch.  If we want to change the default aligning algorithm, I guess I'd rather do that in a follow-up patch.

> > +    sorted_displays = g_new0(guint, ndisplays);
> > +    for (i = 0; i < ndisplays; i++)
> > +        sorted_displays[i] = i;
> > +    g_qsort_with_data(sorted_displays, ndisplays, sizeof(guint),
> > displays_cmp, displays);
> Have you checked against RHEL6? qsort _with_data is not stable before
> glib 2.32 (perhaps we could get the patch backported to rhel though)

Yes, I've tested against RHEL6.  I don't think we actually care about the stability of qsort_with_data here because (1) we already use qsort_with_data in spice-gtk in exactly the same way, and (2) displays_cmp() actually checks for the case where the distance to origin is exactly the same and then falls back to comparing monitor IDs.  So the sort should be stable even if the function g_qsort_with_data is not guaranteed to be stable.


More information about the virt-tools-list mailing list