[virt-tools-list] [PATCH virt-viewer 2/3] spice: if zoom-level is changed, resize guest, even in fullscreen

Marc-André Lureau marcandre.lureau at gmail.com
Tue Jul 23 14:31:38 UTC 2013


---
 src/virt-viewer-display-spice.c | 16 ++++++++++++++++
 src/virt-viewer-display.c       |  1 +
 2 files changed, 17 insertions(+)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 00fcfae..48f07e3 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -251,6 +251,20 @@ virt_viewer_display_spice_size_allocate(VirtViewerDisplaySpice *self,
 }
 
 static void
+zoom_level_changed(VirtViewerDisplaySpice *self,
+                   GParamSpec *pspec G_GNUC_UNUSED,
+                   VirtViewerApp *app G_GNUC_UNUSED)
+{
+    GtkAllocation allocation;
+
+    if (self->priv->auto_resize != AUTO_RESIZE_NEVER)
+        return;
+
+    gtk_widget_get_allocation(GTK_WIDGET(self), &allocation);
+    virt_viewer_display_spice_resize(self, &allocation, TRUE);
+}
+
+static void
 enable_accel_changed(VirtViewerApp *app,
                      GParamSpec *pspec G_GNUC_UNUSED,
                      VirtViewerDisplaySpice *self)
@@ -338,6 +352,8 @@ virt_viewer_display_spice_new(VirtViewerSessionSpice *session,
                                       G_CALLBACK(enable_accel_changed), self, 0);
     virt_viewer_signal_connect_object(self, "notify::fullscreen",
                                       G_CALLBACK(fullscreen_changed), app, 0);
+    virt_viewer_signal_connect_object(self, "notify::zoom-level",
+                                      G_CALLBACK(zoom_level_changed), app, 0);
     fullscreen_changed(self, NULL, app);
     enable_accel_changed(app, NULL, self);
 
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 6af0004..8810254 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -584,6 +584,7 @@ void virt_viewer_display_set_zoom_level(VirtViewerDisplay *display,
     priv->zoom_level = zoom;
 
     virt_viewer_display_queue_resize(display);
+    g_object_notify(G_OBJECT(display), "zoom-level");
 }
 
 
-- 
1.8.3.rc1.49.g8d97506




More information about the virt-tools-list mailing list