[virt-tools-list] [PATCH virt-viewer 1/2] virt-viewer-window: Make sure that minimum zoom level is lower than NORMAL_ZOOM_LEVEL

Pavel Grunt pgrunt at redhat.com
Tue Apr 21 18:48:42 UTC 2015


The minimum size of the desktop is 100x100 if the minimum window size
is greater than this, the zoom level is greater than NORMAL_ZOOM_LEVEL

related: rhbz#1206460
---
 src/virt-viewer-window.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 18ae1bc..3820159 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -1536,7 +1536,8 @@ virt_viewer_window_get_minimal_zoom_level(VirtViewerWindow *self)
     height_ratio = (double) min_height / height;
     zoom = ceil(10 * MAX(width_ratio, height_ratio));
 
-    return MAX(MIN_ZOOM_LEVEL, zoom * ZOOM_STEP);
+    /* make sure that the returned zoom level is in the range from MIN_ZOOM_LEVEL to NORMAL_ZOOM_LEVEL */
+    return MIN(MAX(MIN_ZOOM_LEVEL, zoom * ZOOM_STEP), NORMAL_ZOOM_LEVEL);
 }
 
 /*
-- 
2.3.5




More information about the virt-tools-list mailing list