[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH 1/2] Revert support for resizing guest desktop



From: "Daniel P. Berrange" <berrange redhat com>

The SpiceDisplay widget has built-in support for resizing the
guest desktop, but this does not know that virt-viewer has a
zoom level setting. This makes the virt-viewer zoom completely
inoperable. Revert use of the 'resize-guest' property.
---
 src/virt-viewer-display-spice.c |    4 +---
 src/virt-viewer-display.c       |   21 ++-------------------
 src/virt-viewer-display.h       |    2 --
 3 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 53d0fa6..d3b44b8 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -75,8 +75,6 @@ static void
 virt_viewer_display_spice_init(VirtViewerDisplaySpice *self G_GNUC_UNUSED)
 {
     self->priv = VIRT_VIEWER_DISPLAY_SPICE_GET_PRIVATE(self);
-
-    virt_viewer_display_set_maintain_aspect_ratio(VIRT_VIEWER_DISPLAY(self), FALSE);
 }
 
 static void
@@ -181,8 +179,8 @@ virt_viewer_display_spice_new(SpiceChannel *channel,
     g_object_set(self->priv->display,
                  "grab-keyboard", TRUE,
                  "grab-mouse", TRUE,
+                 "resize-guest", FALSE,
                  "scaling", TRUE,
-                 "resize-guest", TRUE,
                  NULL);
 
     g_signal_connect(self->priv->display,
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 9f51655..1d2ade2 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -40,7 +40,6 @@ struct _VirtViewerDisplayPrivate
     gboolean zoom;
     gint nth_display;
     gint show_hint;
-    gboolean maintain_aspect_ratio;
 };
 
 static void virt_viewer_display_size_request(GtkWidget *widget,
@@ -222,7 +221,6 @@ virt_viewer_display_init(VirtViewerDisplay *display)
     display->priv->zoom_level = 100;
     display->priv->zoom = TRUE;
     display->priv->dirty = TRUE;
-    display->priv->maintain_aspect_ratio = TRUE;
 }
 
 GtkWidget*
@@ -389,13 +387,7 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
 
     desktopAspect = (double)priv->desktopWidth / (double)priv->desktopHeight;
 
-    if (child &&
-        gtk_widget_get_visible(child)) {
-        if (!priv->maintain_aspect_ratio) {
-            gtk_widget_size_allocate(child, allocation);
-            goto end;
-        }
-
+    if (child && gtk_widget_get_visible(child)) {
         border_width = gtk_container_get_border_width(GTK_CONTAINER(display));
 
         width  = MAX(1, allocation->width - 2 * border_width);
@@ -417,7 +409,7 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
         gtk_widget_size_allocate(child, &child_allocation);
     }
 
- end:
+
     /* This unsets the size request, so that the user can
      * manually resize the window smaller again
      */
@@ -428,15 +420,6 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
 }
 
 
-void virt_viewer_display_set_maintain_aspect_ratio(VirtViewerDisplay *display,
-                                                   gboolean maintain)
-{
-    g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(display));
-
-    display->priv->maintain_aspect_ratio = maintain;
-}
-
-
 void virt_viewer_display_set_desktop_size(VirtViewerDisplay *display,
                                           guint width,
                                           guint height)
diff --git a/src/virt-viewer-display.h b/src/virt-viewer-display.h
index bf20bcc..5deb923 100644
--- a/src/virt-viewer-display.h
+++ b/src/virt-viewer-display.h
@@ -84,8 +84,6 @@ GType virt_viewer_display_get_type(void);
 
 GtkWidget *virt_viewer_display_new(void);
 
-void virt_viewer_display_set_maintain_aspect_ratio(VirtViewerDisplay *display,
-                                                   gboolean maintain);
 void virt_viewer_display_set_desktop_size(VirtViewerDisplay *display,
                                           guint width,
                                           guint height);
-- 
1.7.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]