[virt-tools-list] [PATCH virt-viewer] Don't resize guest display on zoom change
Jonathon Jongsma
jjongsma at redhat.com
Thu Mar 6 20:12:00 UTC 2014
It turns out that this change introduces a regression, so I'm going to revert it and investigate a more complete fix.
Jonathon
----- Original Message -----
> From: "Christophe Fergeau" <cfergeau at redhat.com>
> To: "Jonathon Jongsma" <jjongsma at redhat.com>
> Cc: virt-tools-list at redhat.com
> Sent: Monday, February 24, 2014 3:27:56 AM
> Subject: Re: [virt-tools-list] [PATCH virt-viewer] Don't resize guest display on zoom change
>
> On Fri, Feb 21, 2014 at 05:04:17PM -0600, Jonathon Jongsma wrote:
> > When the zoom level is changed, the virt-viewer window gets resized. But we
> > don't want this to trigger a resize of the guest display. But occasionally
> > rounding errors cause the guest display to be reconfigured when zooming
> > out. To
> > fix this, we first check whether the current size is the preferred size.
> > If it
> > is, we don't send down a resize command to the guest.
> >
> > In addition to preventing guest resizes in response to zooming, it also
> > improves
> > the behavior when the guest display resolution is changed from within the
> > guest.
> > Before this change, we'd have the following behavior:
> > A. guest changes display to WxH
> > B. client gets notified of change and resizes the window to WxH
> > C. client responds to window resize by sending a new monitor config
> > command to the guest
> >
> > With this change, the extra step C will be avoided because we're already at
> > the
> > preferred size.
> >
> > Resolves: rhbz#1004051
> > ---
> > src/virt-viewer-display-spice.c | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> > diff --git a/src/virt-viewer-display-spice.c
> > b/src/virt-viewer-display-spice.c
> > index d13fbda..ad3fa4d 100644
> > --- a/src/virt-viewer-display-spice.c
> > +++ b/src/virt-viewer-display-spice.c
> > @@ -193,6 +193,19 @@
> > virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
> > GtkAllocation *allocation
> > G_GNUC_UNUSED,
>
> This G_GNUC_UNUSED can be dropped.
>
> > gpointer data G_GNUC_UNUSED)
> > {
> > + GtkRequisition preferred;
> > + gtk_widget_get_preferred_size(GTK_WIDGET(self), NULL, &preferred);
> > +
> > + /* when the window gets resized due to a change in zoom level, we
> > don't want
> > + * to re-size the guest display. So if we get an allocation event
> > that
> > + * resizes the window to the size it already wants to be (based on
> > desktop
> > + * size and zoom level), just return early
> > + */
> > + if (preferred.width == allocation->width
> > + && preferred.height == allocation->height) {
> > + return;
> > + }
> > +
>
> Not very familiar with all that code, but why not.. ACK
>
> Christophe
>
More information about the virt-tools-list
mailing list