[Spice-devel] [spice-gtk] Spice-widget: Allow smaller widget with scaling enabled

Javier Celaya javier.celaya at flexvdi.com
Wed Apr 13 11:42:22 UTC 2016


With scaling enabled, the size request of the widget must be 640x480
(the same as with resize_guest_enable) so that the widget can be
actually scalled down.
---
 src/spice-widget.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 6f638fb..f445f3f 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -169,23 +169,12 @@ static void spice_display_get_property(GObject    *object,
     }
 }
 
-static void scaling_updated(SpiceDisplay *display)
-{
-    SpiceDisplayPrivate *d = display->priv;
-    GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
-
-    recalc_geometry(GTK_WIDGET(display));
-    if (d->ximage && window) { /* if not yet shown */
-        gtk_widget_queue_draw(GTK_WIDGET(display));
-    }
-}
-
 static void update_size_request(SpiceDisplay *display)
 {
     SpiceDisplayPrivate *d = display->priv;
     gint reqwidth, reqheight;
 
-    if (d->resize_guest_enable) {
+    if (d->resize_guest_enable || d->allow_scaling) {
         reqwidth = 640;
         reqheight = 480;
     } else {
@@ -197,6 +186,18 @@ static void update_size_request(SpiceDisplay *display)
     recalc_geometry(GTK_WIDGET(display));
 }
 
+static void scaling_updated(SpiceDisplay *display)
+{
+    SpiceDisplayPrivate *d = display->priv;
+    GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
+
+    recalc_geometry(GTK_WIDGET(display));
+    if (d->ximage && window) { /* if not yet shown */
+        gtk_widget_queue_draw(GTK_WIDGET(display));
+    }
+    update_size_request(display);
+}
+
 static void update_keyboard_focus(SpiceDisplay *display, gboolean state)
 {
     SpiceDisplayPrivate *d = display->priv;
-- 
2.4.3



More information about the Spice-devel mailing list