[virt-tools-list] [PATCH virt-viewer] rhbz#1111514: Fix un-shrinkable displays on windows guests

Jonathon Jongsma jjongsma at redhat.com
Fri Jun 20 20:02:28 UTC 2014


Commit 6edde5786 introduced a regression wrt shrinking windows on windows
guests. This seems to be because resizing a display often causes the notebook
widget to switch to the status page temporarily (often so quickly that it's not
noticeable to the eye). This causes a quick 'unmap' and 'map' event sequence on
the display widget. Apparently the timing of these events varies enough between
linux and windows guests that it is only noticeable on windows gueststhe timing
of these events varies enough between linux and windows guests that it is only
noticeable on windows guests. The exact sequence that causes the bug appears to
be as follows:

1 user resizes window smaller
2 display widget gets a new allocation, which causes it to send a display
  reconfiguration to the guest
3 client receives a new show-hint for the display which causes it to switch
  temporarily to the 'status' notebook page
4 display widget gets unmapped
5 Client receives another new show-hint, which causes the display widget to get
  re- mapped, which causes client to send a display reconfiguration to the guest
  (using the old size)
6 client receives new (smaller, from step 2) display size and temporarily
  changes to the new size
7 client receives new (larger, from step 5) display size and changes back to
  original size.

To fix the issue, we only explicitly request a resize in response to the very
first map event, and for any subsequent map events, we simply call
_make_resizable() as before.
---
 src/virt-viewer-display.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index c5170c4..e91450f 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -38,6 +38,7 @@ struct _VirtViewerDisplayPrivate
 {
 #if !GTK_CHECK_VERSION(3, 0, 0)
     gboolean dirty;
+    gboolean mapped_once;
 #endif
     guint desktopWidth;
     guint desktopHeight;
@@ -452,9 +453,16 @@ virt_viewer_display_make_resizable(VirtViewerDisplay *self)
 static void
 virt_viewer_display_map(GtkWidget *widget)
 {
+    VirtViewerDisplay* self = VIRT_VIEWER_DISPLAY(widget);
+
     GTK_WIDGET_CLASS(virt_viewer_display_parent_class)->map(widget);
 
-    virt_viewer_display_queue_resize(VIRT_VIEWER_DISPLAY(widget));
+    if (!self->priv->mapped_once)
+        virt_viewer_display_queue_resize(self);
+    else
+        virt_viewer_display_make_resizable(self);
+
+    self->priv->mapped_once = TRUE;
 }
 
 #else
-- 
1.9.3




More information about the virt-tools-list mailing list