diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-06-20 14:47:26 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-07-16 17:46:41 +0200 |
commit | 6106d1aaa4c4f18ae29865a70aca9212b088f756 (patch) | |
tree | f3cb150ea4ff07ced356654b8da4f3e5004380b3 | |
parent | 8ee26756499604c329af98cf8c19daff3d1caa7d (diff) |
Handle SPICE_MSG_DISPLAY_MONITORS_CONFIG
-rw-r--r-- | gtk/channel-display.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gtk/channel-display.c b/gtk/channel-display.c index 675ea14..3cd133e 100644 --- a/gtk/channel-display.c +++ b/gtk/channel-display.c @@ -1458,6 +1458,37 @@ static void display_handle_surface_destroy(SpiceChannel *channel, SpiceMsgIn *in free(surface); } +/* coroutine context */ +static void display_handle_monitors_config(SpiceChannel *channel, SpiceMsgIn *in) +{ + SpiceMsgDisplayMonitorsConfig *config = spice_msg_in_parsed(in); + SpiceDisplayChannelPrivate *c = SPICE_DISPLAY_CHANNEL(channel)->priv; + guint i; + + g_return_if_fail(config != NULL); + g_return_if_fail(config->count > 0); + + SPICE_DEBUG("monitors config: n: %d", config->count); + + c->monitors = g_array_set_size(c->monitors, config->count); + + for (i = 0; i < config->count; i++) { + SpiceDisplayMonitorConfig *mc = &g_array_index(c->monitors, SpiceDisplayMonitorConfig, i); + SpiceHead *head = &config->heads[i]; + SPICE_DEBUG("monitor id: %u, surface id: %u, +%u+%u-%ux%u", + head->id, head->surface_id, + head->x, head->y, head->width, head->height); + mc->id = head->id; + mc->surface_id = head->surface_id; + mc->x = head->x; + mc->y = head->y; + mc->width = head->width; + mc->height = head->height; + } + + g_object_notify_main_context(G_OBJECT(channel), "monitors"); +} + static const spice_msg_handler display_handlers[] = { [ SPICE_MSG_DISPLAY_MODE ] = display_handle_mode, [ SPICE_MSG_DISPLAY_MARK ] = display_handle_mark, @@ -1490,6 +1521,8 @@ static const spice_msg_handler display_handlers[] = { [ SPICE_MSG_DISPLAY_SURFACE_CREATE ] = display_handle_surface_create, [ SPICE_MSG_DISPLAY_SURFACE_DESTROY ] = display_handle_surface_destroy, + + [ SPICE_MSG_DISPLAY_MONITORS_CONFIG ] = display_handle_monitors_config, }; /* coroutine context */ |