[virt-tools-list] [virt-viewer 1/3] display: Only queue a resize on	zoom-level changes
    Fabiano Fidêncio 
    fidencio at redhat.com
       
    Fri Jun 10 15:22:17 UTC 2016
    
    
  
By the comment in the code:
"For the gtk2 build, we need to queue a resize even if the zoom level
 hasn't changed.  This is due to the fact that VirtViewerWindow will
 queue a resize event for itself immediately after calling this
 function (in  order to shrink the window to fit the new display size
 if necessary). If we don't queue a resize here, the window will become
 tiny because we will only request 50x50 during the window resize."
And it doesn't happen on gtk3 at all. So, let's just remove the comment
and just quere the resize when zoom-changes actually happen.
Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 src/virt-viewer-display.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 16fb930..c2e6c4d 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -489,19 +489,12 @@ void virt_viewer_display_set_zoom_level(VirtViewerDisplay *display,
     if (zoom > MAX_ZOOM_LEVEL)
         zoom = MAX_ZOOM_LEVEL;
 
-    // For the gtk2 build, we need to queue a resize even if the zoom level
-    // hasn't changed.  This is due to the fact that VirtViewerWindow will queue
-    // a resize event for itself immediately after calling this function (in
-    // order to shrink the window to fit the new display size if necessary). If
-    // we don't queue a resize here, the window will become tiny because we will
-    // only request 50x50 during the window resize
-    virt_viewer_display_queue_resize(display);
-
     if (priv->zoom_level == zoom)
         return;
 
     priv->zoom_level = zoom;
 
+    virt_viewer_display_queue_resize(display);
     g_object_notify(G_OBJECT(display), "zoom-level");
 }
 
-- 
2.7.4
    
    
More information about the virt-tools-list
mailing list