[virt-tools-list] [PATCH virt-viewer 1/4] virt-viewer-window: Change zoom with respect to real zoom
Pavel Grunt
pgrunt at redhat.com
Thu Jul 16 08:20:55 UTC 2015
On Wed, 2015-07-15 at 13:11 -0500, Jonathon Jongsma wrote:
> OK.
>
> (by the way, didn't you submit a similar patch a while back? What ever
> happened to that one? or is this the same one?)
It is the same one, it just didn't get a reply:
https://www.redhat.com/archives/virt-tools-list/2015-June/msg00036.html
Pavel
>
> On Tue, 2015-07-14 at 16:13 +0200, Pavel Grunt wrote:
> > The zoom can be changed by resizing the window (VNC / Spice without
> > the agent). It is necessary to recalculate the zoom level before
> > changing it, otherwise zoom operations will not work correctly.
> >
> > Resolves:
> > https://bugs.freedesktop.org/show_bug.cgi?id=90582
> > ---
> > src/virt-viewer-window.c | 20 +++++++++++++++++---
> > 1 file changed, 17 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
> > index d67fbc1..71e6575 100644
> > --- a/src/virt-viewer-window.c
> > +++ b/src/virt-viewer-window.c
> > @@ -368,19 +368,32 @@ virt_viewer_window_desktop_resize(VirtViewerDisplay
> > *display G_GNUC_UNUSED,
> > virt_viewer_window_resize(self, FALSE);
> > }
> >
> > +static gint
> > +virt_viewer_window_get_real_zoom_level(VirtViewerWindow *self)
> > +{
> > + GtkAllocation allocation;
> > + guint width, height;
> > +
> > + gtk_widget_get_allocation(GTK_WIDGET(self->priv->display),
> > &allocation);
> > + virt_viewer_display_get_desktop_size(self->priv->display, &width,
> > &height);
> > +
> > + return round((double) NORMAL_ZOOM_LEVEL * allocation.width / width);
> > +}
> >
> > 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, self->priv->zoomlevel -
> > ZOOM_STEP);
> > + 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, self->priv->zoomlevel +
> > ZOOM_STEP);
> > + virt_viewer_window_set_zoom_level(self,
> > +
> > virt_viewer_window_get_real_zoom_level(self) + ZOOM_STEP);
> > }
> >
> > G_MODULE_EXPORT void
> > @@ -1471,7 +1484,8 @@ virt_viewer_window_set_zoom_level(VirtViewerWindow
> > *self, gint zoom_level)
> > priv->zoomlevel = min_zoom;
> > }
> >
> > - if (priv->zoomlevel == virt_viewer_display_get_zoom_level(priv
> > ->display)) {
> > + if (priv->zoomlevel == virt_viewer_display_get_zoom_level(priv
> > ->display) &&
> > + priv->zoomlevel == virt_viewer_window_get_real_zoom_level(self)) {
> > g_debug("Zoom level not changed, using: %d", priv->zoomlevel);
> > return;
> > }
>
>
More information about the virt-tools-list
mailing list