On 02/03/2016 06:08 AM, Pavel Grunt wrote:
> ---
> src/virt-viewer-display.c | 39 ++-
> 1 file changed, 18 insertions(+), 21 deletions(-)
>
> diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
> index 72ec56a..4bfa29b 100644
> --- a/src/virt-viewer-display.c
> +++ b/src/virt-viewer-display.c
> @@ -511,37 +511,34 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
> g_debug("Allocated %dx%d", allocation->width, allocation->height);
> gtk_widget_set_allocation(widget, allocation);
>
> -if (priv->desktopWidth == 0 ||
> -priv->desktopHeight == 0)
> +if (priv->desktopWidth == 0 || priv->desktopHeight == 0 ||
> +child == NULL || !gtk_widget_get_visible(child))
> #if !GTK_CHECK_VERSION(3, 0, 0)
> goto end;
> #else
> return;
> #endif
> +border_width = gtk_container_get_border_width(GTK_CONTAINER(display));
>
> -desktopAspect = (double)priv->desktopWidth / (double)priv->desktopHeight;
> +width = MAX(1, allocation->width - 2 * border_width);
> +height = MAX(1, allocation->height - 2 * border_width);
>
> -if (child && gtk_widget_get_visible(child)) {
> -border_width =
> gtk_container_get_border_width(GTK_CONTAINER(display));
> -
> -width = MAX(1, allocation->width - 2 * border_width);
> -height = MAX(1, allocation->height - 2 * border_width);
> -actualAspect = (double)width / (double)height;
> +desktopAspect = (double) priv->desktopWidth / (double)
> priv->desktopHeight;
> +actualAspect = (double) width / (double) height;
>
> -if (actualAspect > desktopAspect) {
> -child_allocation.width = round(height * desktopAspect);
> -child_allocation.height = height;
> -} else {
> -child_allocation.width = width;
> -child_allocation.height = round(width / desktopAspect);
> -}
> +if (actualAspect > desktopAspect) {
> +child_allocation.width = round(height * desktopAspect);
> +child_allocation.height = height;
> +} else {
> +child_allocation.width = width;
> +child_allocation.height = round(width / desktopAspect);
> +}
>
> -child_allocation.x = 0.5 * (width - child_allocation.width) +
> allocation->x + border_width;
> -child_allocation.y = 0.5 * (height - child_allocation.height) +
> allocation->y + border_width;
> +child_allocation.x = 0.5 * (width - child_allocation.width) +
> allocation->x + border_width;
> +child_allocation.y = 0.5 * (height - child_allocation.height) +
> allocation->y + border_width;
>
> -g_debug("Child allocate %dx%d", child_allocation.width,
> child_allocation.height);
> -gtk_widget_size_allocate(child, _allocation);
> -}
> +g_debug("Child allocate %dx%d", child_allocation.width,
> child_allocation.height);
> +gtk_widget_size_allocate(child, _allocation);
>
> #if !GTK_CHECK_VERSION(3, 0, 0)
> end:
>
Acked-by: Eduardo Lima (Etrunko)
--
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etru...@redhat.com
___
virt-tools-list mailing list
virt-tools-list@redhat.com
https://www.redhat.com/mailman/listinfo/virt-tools-list