----- Original Message ----- > 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 > v2: > - spice_main_keyboard_description changed to > spice_main_send_keyboard_description > - removed unnecessary 'size' parameter > --- > gtk/channel-main.c | 29 +++++++++++++++++++++++++++++ > gtk/channel-main.h | 1 + > gtk/map-file | 1 + > 3 files changed, 31 insertions(+) > > diff --git a/gtk/channel-main.c b/gtk/channel-main.c > index 1ad090f..4460c5a 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,23 @@ 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. > + * Add a Since: 2.27 tag You'll have to add the symbol to doc/reference/spice-gtk-sections.txt > + **/ > +void spice_main_send_keyboard_description(SpiceMainChannel *channel, const > gchar *data) > +{ > + g_return_if_fail(channel != NULL); > + g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); missing g_return_if_fail(data != NULL); (all arguments of public API must be checked) > + > + 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; > -- > 1.9.3 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/spice-devel > _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel