This commit introduces function for sending the message to the agent. RFE: https://bugs.freedesktop.org/show_bug.cgi?id=85332 --- depends on: http://lists.freedesktop.org/archives/spice-devel/2014-November/017821.html --- gtk/channel-main.c | 32 ++++++++++++++++++++++++++++++++ gtk/channel-main.h | 2 ++ gtk/map-file | 1 + 3 files changed, 35 insertions(+) diff --git a/gtk/channel-main.c b/gtk/channel-main.c index 1ad090f..66587d6 100644 --- a/gtk/channel-main.c +++ b/gtk/channel-main.c @@ -187,6 +187,7 @@ static const char *agent_msg_types[] = { [ VD_AGENT_CLIPBOARD_GRAB ] = "clipboard grab", [ VD_AGENT_CLIPBOARD_REQUEST ] = "clipboard request", [ VD_AGENT_CLIPBOARD_RELEASE ] = "clipboard release", + [ VD_AGENT_KEYBOARD_DESCRIPTION ] = "keyboard description", }; static const char *agent_caps[] = { @@ -1282,6 +1283,18 @@ static void agent_clipboard_release(SpiceMainChannel *channel, guint selection) agent_msg_queue(channel, VD_AGENT_CLIPBOARD_RELEASE, msgsize, msg); } +/* any context: the message is not flushed immediately, + you can wakeup() the channel coroutine or send_msg_queue() */ +static void agent_keyboard_description(SpiceMainChannel *channel, + const gchar *data, size_t size) +{ + SpiceMainChannelPrivate *c = channel->priv; + + g_return_if_fail(c->agent_connected); + + agent_msg_queue(channel, VD_AGENT_KEYBOARD_DESCRIPTION, size, data); +} + /* main context*/ static gboolean timer_set_display(gpointer data) { @@ -2630,6 +2643,25 @@ void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean update_display_timer(channel, 1); } +/** + * spice_main_keyboard_description: + * @channel: a #SpiceMainChannel + * @data: keyboard description + * @size: data length in bytes + * + * Send the keyboard description to the guest. + * + **/ +void spice_main_keyboard_description(SpiceMainChannel *channel, + const gchar *data, size_t size) +{ + g_return_if_fail(channel != NULL); + g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); + + agent_keyboard_description(channel, data, size); + spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE); +} + static void file_xfer_completed(SpiceFileXferTask *task, GError *error) { /* In case of multiple errors we only report the first error */ diff --git a/gtk/channel-main.h b/gtk/channel-main.h index 3e4fc42..cd122a7 100644 --- a/gtk/channel-main.h +++ b/gtk/channel-main.h @@ -93,6 +93,8 @@ gboolean spice_main_file_copy_finish(SpiceMainChannel *channel, GAsyncResult *result, GError **error); +void spice_main_keyboard_description(SpiceMainChannel *channel, + const gchar *data, size_t size); #ifndef SPICE_DISABLE_DEPRECATED SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_grab) void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes); diff --git a/gtk/map-file b/gtk/map-file index 9f8d04e..2bbc62e 100644 --- a/gtk/map-file +++ b/gtk/map-file @@ -67,6 +67,7 @@ spice_main_clipboard_selection_release; spice_main_clipboard_selection_request; spice_main_file_copy_async; spice_main_file_copy_finish; +spice_main_keyboard_description; spice_main_send_monitor_config; spice_main_set_display; spice_main_set_display_enabled; -- 1.9.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel