[virt-tools-list] [PATCH v2 05/16] window/zoom: deal with VTE display differently

Victor Toso victortoso at redhat.com
Thu Dec 20 16:14:12 UTC 2018


Hi,

On Wed, Sep 26, 2018 at 07:26:28PM +0400, marcandre.lureau at redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
> 
> VTE display doesn't use the desktop / window aspect ratio, let's just
> call directly the functions handling zoom.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  src/virt-viewer-window.c | 28 ++++++++++++++++++++++------
>  1 file changed, 22 insertions(+), 6 deletions(-)
> 
> diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> index e50ac54..67e6f4f 100644
> --- a/src/virt-viewer-window.c
> +++ b/src/virt-viewer-window.c
> @@ -42,6 +42,7 @@
>  #include "virt-viewer-app.h"
>  #include "virt-viewer-util.h"
>  #include "virt-viewer-timed-revealer.h"
> +#include "virt-viewer-display-vte.h"
>  
>  #include "remote-viewer-iso-list-dialog.h"
>  
> @@ -383,23 +384,35 @@ G_MODULE_EXPORT void
>  virt_viewer_window_menu_view_zoom_out(GtkWidget *menu G_GNUC_UNUSED,
>                                        VirtViewerWindow *self)
>  {
> -    virt_viewer_window_set_zoom_level(self,
> -                                      virt_viewer_window_get_real_zoom_level(self) - ZOOM_STEP);
> +    if (VIRT_VIEWER_IS_DISPLAY_VTE(self->priv->display)) {
> +        virt_viewer_display_vte_zoom_out(VIRT_VIEWER_DISPLAY_VTE(self->priv->display));
> +    } else {
> +        virt_viewer_window_set_zoom_level(self,
> +                                          virt_viewer_window_get_real_zoom_level(self) - ZOOM_STEP);
> +    }
>  }
>  
>  G_MODULE_EXPORT void
>  virt_viewer_window_menu_view_zoom_in(GtkWidget *menu G_GNUC_UNUSED,
>                                       VirtViewerWindow *self)
>  {
> -    virt_viewer_window_set_zoom_level(self,
> -                                      virt_viewer_window_get_real_zoom_level(self) + ZOOM_STEP);
> +    if (VIRT_VIEWER_IS_DISPLAY_VTE(self->priv->display)) {
> +        virt_viewer_display_vte_zoom_in(VIRT_VIEWER_DISPLAY_VTE(self->priv->display));
> +    } else {
> +        virt_viewer_window_set_zoom_level(self,
> +                                          virt_viewer_window_get_real_zoom_level(self) + ZOOM_STEP);
> +    }
>  }
>  
>  G_MODULE_EXPORT void
>  virt_viewer_window_menu_view_zoom_reset(GtkWidget *menu G_GNUC_UNUSED,
>                                          VirtViewerWindow *self)
>  {
> -    virt_viewer_window_set_zoom_level(self, NORMAL_ZOOM_LEVEL);
> +    if (VIRT_VIEWER_IS_DISPLAY_VTE(self->priv->display)) {
> +        virt_viewer_display_vte_zoom_reset(VIRT_VIEWER_DISPLAY_VTE(self->priv->display));
> +    } else {
> +        virt_viewer_window_set_zoom_level(self, NORMAL_ZOOM_LEVEL);
> +    }
>  }
>  
>  /* Kick GtkWindow to tell it to adjust to our new widget sizes */
> @@ -1521,7 +1534,10 @@ virt_viewer_window_set_zoom_level(VirtViewerWindow *self, gint zoom_level)
>  
>      virt_viewer_display_set_zoom_level(VIRT_VIEWER_DISPLAY(priv->display), priv->zoomlevel);

Maybe move the virt_viewer_display_set_zoom_level() call too?

> -    virt_viewer_window_queue_resize(self);
> +    if (VIRT_VIEWER_IS_DISPLAY_VTE(priv->display)) {
> +    } else {
> +        virt_viewer_window_queue_resize(self);
> +    }

Any strong reason to keep empty if + else instead of
if(!_IS_DISPLAY_VTE()) ?

Works without any issues so,
Acked-by: Victor Toso <victortoso at redhat.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20181220/36b5da6d/attachment.sig>


More information about the virt-tools-list mailing list