virt-viewer-window: Make sure that minimum zoom level is lower than NORMAL_ZOOM_LEVEL

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
This commit is contained in:
Pavel Grunt 2015-04-21 18:37:16 +02:00
parent 82d6280e5c
commit 41645a0eb5

View File

@ -1576,7 +1576,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 CLAMP(zoom * ZOOM_STEP, MIN_ZOOM_LEVEL, NORMAL_ZOOM_LEVEL);
}
/*