[virt-tools-list] [PATCH 4/4] virt-viewer-window: Don't try to resize non visible windows

Hans de Goede hdegoede at redhat.com
Mon Mar 5 15:22:10 UTC 2012


Trying to resize not visible windows leads to the following being printed
to the console:
Gdk-CRITICAL **: IA__gdk_window_get_origin: assertion `GDK_IS_WINDOW (window)'

This gets triggered by the gdk_screen_get_monitor_geometry() call in
virt_viewer_window_resize()

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/virt-viewer-window.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index d80d760..70f88a6 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -106,6 +106,7 @@ struct _VirtViewerWindowPrivate {
     gboolean grabbed;
     gboolean before_saved;
     GdkRectangle before_fullscreen;
+    gboolean desktop_resize_pending;
 
     gint zoomlevel;
     gboolean auto_resize;
@@ -323,6 +324,10 @@ static void
 virt_viewer_window_desktop_resize(VirtViewerDisplay *display G_GNUC_UNUSED,
                                   VirtViewerWindow *self)
 {
+    if (!gtk_widget_get_visible(self->priv->window)) {
+        self->priv->desktop_resize_pending = TRUE;
+        return;
+    }
     virt_viewer_window_resize(self);
 }
 
@@ -960,6 +965,11 @@ void
 virt_viewer_window_show(VirtViewerWindow *self)
 {
     gtk_widget_show(self->priv->window);
+
+    if (self->priv->desktop_resize_pending) {
+        virt_viewer_window_resize(self);
+        self->priv->desktop_resize_pending = FALSE;
+    }
 }
 
 void
-- 
1.7.7.6




More information about the virt-tools-list mailing list