[Spice-devel] [PATCH spice-gtk 17/25] Make-up a MonitorConfig if the server doesn't provide one

Marc-André Lureau marcandre.lureau at gmail.com
Thu Jul 12 15:29:14 PDT 2012


This allows easier compatibility for clients that don't have to
check and interact differently depending on channel capabilities.
---
 gtk/channel-display.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index e6fd388..b701d1b 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -743,10 +743,21 @@ static int create_canvas(SpiceChannel *channel, display_surface *surface)
     g_return_val_if_fail(surface->canvas != NULL, 0);
     ring_add(&c->surfaces, &surface->link);
 
-    if (surface->primary)
+    if (surface->primary) {
         emit_main_context(channel, SPICE_DISPLAY_PRIMARY_CREATE,
                           surface->format, surface->width, surface->height,
                           surface->stride, surface->shmid, surface->data);
+
+        if (!spice_channel_test_capability(channel, SPICE_DISPLAY_CAP_MONITORS_CONFIG)) {
+            g_array_set_size(c->monitors, 1);
+            SpiceDisplayMonitorConfig *config = &g_array_index(c->monitors, SpiceDisplayMonitorConfig, 0);
+            config->x = config->y = 0;
+            config->width = surface->width;
+            config->height = surface->height;
+            g_object_notify_main_context(G_OBJECT(channel), "monitors");
+        }
+    }
+
     return 0;
 }
 
-- 
1.7.10.4



More information about the Spice-devel mailing list