summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2012-06-20 14:49:07 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2012-07-16 17:46:41 +0200
commit0b0ec738a9779dc3c37cf0573e3846be0729a5ce (patch)
treede9fb94a2100ca8838b947f312aac5aae59bf5bd
parent6106d1aaa4c4f18ae29865a70aca9212b088f756 (diff)
Make-up a MonitorConfig if the server doesn't provide one
This allows easier compatibility for clients that don't have to check and interact differently depending on channel capabilities.
-rw-r--r--gtk/channel-display.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gtk/channel-display.c b/gtk/channel-display.c
index 3cd133e..637a6cf 100644
--- a/gtk/channel-display.c
+++ b/gtk/channel-display.c
@@ -744,10 +744,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;
}