This commit introduces function for sending the message to the agent. RFE: https://bugs.freedesktop.org/show_bug.cgi?id=85332 --- v4: - updated spice-glib-sym-file v3: - added 'Since: 0.27' - added check for 'data' parameter - updated spice-gtk-sections.txt v2: - spice_main_keyboard_description changed to spice_main_send_keyboard_description - removed unnecessary 'size' parameter --- doc/reference/spice-gtk-sections.txt | 1 + gtk/channel-main.c | 31 +++++++++++++++++++++++++++++++ gtk/channel-main.h | 1 + gtk/map-file | 1 + gtk/spice-glib-sym-file | 1 + 5 files changed, 35 insertions(+) diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt index caaa92c..df317f9 100644 --- a/doc/reference/spice-gtk-sections.txt +++ b/doc/reference/spice-gtk-sections.txt @@ -62,6 +62,7 @@ SpiceMainChannelClass <SUBSECTION> spice_main_set_display spice_main_set_display_enabled +spice_main_send_keyboard_description spice_main_send_monitor_config spice_main_agent_test_capability spice_main_clipboard_selection_grab diff --git a/gtk/channel-main.c b/gtk/channel-main.c index 1ad090f..a434e29 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,17 @@ 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_send_keyboard_description(SpiceMainChannel *channel, const gchar *data) +{ + SpiceMainChannelPrivate *c = channel->priv; + + g_return_if_fail(c->agent_connected); + + agent_msg_queue(channel, VD_AGENT_KEYBOARD_DESCRIPTION, strlen(data)+1, data); +} + /* main context*/ static gboolean timer_set_display(gpointer data) { @@ -2630,6 +2642,25 @@ void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean update_display_timer(channel, 1); } +/** + * spice_main_send_keyboard_description: + * @channel: a #SpiceMainChannel + * @data: keyboard description + * + * Send the keyboard description to the guest. + * + * Since: 0.27 + **/ +void spice_main_send_keyboard_description(SpiceMainChannel *channel, const gchar *data) +{ + g_return_if_fail(channel != NULL); + g_return_if_fail(data != NULL); + g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); + + agent_send_keyboard_description(channel, data); + 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..cb239d6 100644 --- a/gtk/channel-main.h +++ b/gtk/channel-main.h @@ -93,6 +93,7 @@ gboolean spice_main_file_copy_finish(SpiceMainChannel *channel, GAsyncResult *result, GError **error); +void spice_main_send_keyboard_description(SpiceMainChannel *channel, const gchar *data); #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..619b362 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_send_keyboard_description; spice_main_send_monitor_config; spice_main_set_display; spice_main_set_display_enabled; diff --git a/gtk/spice-glib-sym-file b/gtk/spice-glib-sym-file index 2189fa5..6ec6d62 100644 --- a/gtk/spice-glib-sym-file +++ b/gtk/spice-glib-sym-file @@ -44,6 +44,7 @@ spice_main_clipboard_selection_release spice_main_clipboard_selection_request spice_main_file_copy_async spice_main_file_copy_finish +spice_main_send_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