[virt-tools-list] [PATCH virt-viewer] Fix regression with enabling additional displays

Jonathon Jongsma jjongsma at redhat.com
Thu Mar 27 14:42:24 UTC 2014


This patch still needs review.  Any takers?



----- Original Message -----
> From: "Jonathon Jongsma" <jjongsma at redhat.com>
> To: virt-tools-list at redhat.com
> Sent: Friday, March 14, 2014 3:45:21 PM
> Subject: [virt-tools-list] [PATCH virt-viewer] Fix regression with enabling	additional displays
> 
> Commit 8fa942 broke enabling of additional displays. We don't want to send
> down
> display re-configurations due to events that happen while setting up windows
> for
> enabled displays that we recieve from the server. However, by ignoring
> allocations on unmapped windows, we fail to send display configurations for
> new
> displays that a user is attempting to enable via the window menu. To
> discriminate between these two cases, we check whether the display is in the
> 'ready' state or not.
> - Unmapped displays with the 'ready' hint set can be assumed to be displays
>   that are enabled on the server that we are attempting to create windows for
>   on
>   the client. In this case, we should *not* send a display configuration to
>   the
>   server
> - Unmapped displays with the 'ready' hint cleared can be assumed to be
> displays
>   that are not yet enabled on the server that we are trying to enable in the
>   client. In this case, we *should* send a display configuration to the
>   server
> ---
>  src/virt-viewer-display-spice.c | 36 ++++++++++++++++++++----------------
>  1 file changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/src/virt-viewer-display-spice.c
> b/src/virt-viewer-display-spice.c
> index c44dfcb..76dfb47 100644
> --- a/src/virt-viewer-display-spice.c
> +++ b/src/virt-viewer-display-spice.c
> @@ -189,22 +189,26 @@
> virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
>                                          gpointer data G_GNUC_UNUSED)
>  {
>      GtkRequisition preferred;
> -
> -    /* ignore all allocations before the widget gets mapped to screen since
> we
> -     * only want to trigger guest resizing due to user actions
> -     */
> -    if (!gtk_widget_get_mapped(GTK_WIDGET(self)))
> -        return;
> -
> -    /* 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
> -     */
> -    gtk_widget_get_preferred_size(GTK_WIDGET(self), NULL, &preferred);
> -    if (preferred.width == allocation->width
> -        && preferred.height == allocation->height) {
> -        return;
> +    guint hint =
> virt_viewer_display_get_show_hint(VIRT_VIEWER_DISPLAY(self));
> +
> +    if (hint & VIRT_VIEWER_DISPLAY_SHOW_HINT_READY)
> +    {
> +        /* ignore all allocations before the widget gets mapped to screen
> since we
> +         * only want to trigger guest resizing due to user actions
> +         */
> +        if (!gtk_widget_get_mapped(GTK_WIDGET(self)))
> +            return;
> +
> +        /* 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
> +         */
> +        gtk_widget_get_preferred_size(GTK_WIDGET(self), NULL, &preferred);
> +        if (preferred.width == allocation->width
> +            && preferred.height == allocation->height) {
> +            return;
> +        }
>      }
>  
>      if (self->priv->auto_resize != AUTO_RESIZE_NEVER)
> --
> 1.8.5.3
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
> 




More information about the virt-tools-list mailing list