[virt-tools-list] [PATCH virt-viewer 2/3] virt-viewer-window: Return early when zoom of window and zoom of display are same

Pavel Grunt pgrunt at redhat.com
Sun Apr 5 13:45:01 UTC 2015


The zoom level should be changed when zoom levels of the window and
the display are different. It is wrong to check the previous value of
the window because it could be set just for the window and not for
the display (e.g. when setting zoom level using the command line).

Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1206460
---
 src/virt-viewer-window.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index e4ec265..18ae1bc 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -1409,11 +1409,10 @@ void
 virt_viewer_window_set_zoom_level(VirtViewerWindow *self, gint zoom_level)
 {
     VirtViewerWindowPrivate *priv;
-    gint min_zoom, old_zoom;
+    gint min_zoom;
 
     g_return_if_fail(VIRT_VIEWER_IS_WINDOW(self));
     priv = self->priv;
-    old_zoom = priv->zoomlevel;
 
     if (zoom_level < MIN_ZOOM_LEVEL)
         zoom_level = MIN_ZOOM_LEVEL;
@@ -1430,7 +1429,7 @@ virt_viewer_window_set_zoom_level(VirtViewerWindow *self, gint zoom_level)
         priv->zoomlevel = min_zoom;
     }
 
-    if (priv->zoomlevel == old_zoom) {
+    if (priv->zoomlevel == virt_viewer_display_get_zoom_level(priv->display)) {
         g_debug("Zoom level not changed, using: %d", priv->zoomlevel);
         return;
     }
-- 
2.3.4




More information about the virt-tools-list mailing list