[PATCH spice-gtk 2/2] Support for VD_AGENT_INFORMATION message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The client will ask the agent for its version and save the agent's answer
in the "agent-version" property of SpiceSession
---
depends on http://lists.freedesktop.org/archives/spice-devel/2014-October/017654.html
and on http://lists.freedesktop.org/archives/spice-devel/2014-October/017655.html
or on http://lists.freedesktop.org/archives/spice-devel/2014-October/017656.html
---
 gtk/channel-main.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 1ad090f..f7fd3c1 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_INFORMATION             ] = "version informations",
 };
 
 static const char *agent_caps[] = {
@@ -1149,6 +1150,19 @@ static void agent_announce_caps(SpiceMainChannel *channel)
 
 /* any context: the message is not flushed immediately,
    you can wakeup() the channel coroutine or send_msg_queue() */
+static void agent_version_info(SpiceMainChannel *channel)
+{
+    SpiceMainChannelPrivate *c = channel->priv;
+    VDAgentInformation msg;
+    if (!c->agent_connected)
+        return;
+
+    msg.type = VD_AGENT_INFORMATION_VERSION;
+    agent_msg_queue(channel, VD_AGENT_INFORMATION, sizeof(VDAgentInformation), &msg);
+}
+
+/* any context: the message is not flushed immediately,
+   you can wakeup() the channel coroutine or send_msg_queue() */
 static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection,
                                  guint32 *types, int ntypes)
 {
@@ -1354,6 +1368,7 @@ static void agent_start(SpiceMainChannel *channel)
 
     if (c->agent_connected) {
         agent_announce_caps(channel);
+        agent_version_info(channel);
         agent_send_msg_queue(channel);
     }
 }
@@ -1745,6 +1760,16 @@ static void spice_main_set_max_clipboard(SpiceMainChannel *self, gint max)
     agent_max_clipboard(self);
     spice_channel_wakeup(SPICE_CHANNEL(self), FALSE);
 }
+/* coroutine context */
+static void agent_information(SpiceChannel *channel, VDAgentInformation *msg)
+{
+    SpiceSession *session = spice_channel_get_session(channel);
+
+    if (msg->type == VD_AGENT_INFORMATION_VERSION) {
+        SPICE_DEBUG("agent version: %s", (gchar *) msg->data);
+        spice_session_set_agent_version(session, (gchar *) msg->data);
+    }
+}
 
 /* coroutine context */
 static void main_agent_handle_msg(SpiceChannel *channel,
@@ -1855,6 +1880,12 @@ static void main_agent_handle_msg(SpiceChannel *channel,
                     reply->error == VD_AGENT_SUCCESS ? "success" : "error");
         break;
     }
+    case VD_AGENT_INFORMATION:
+    {
+        VDAgentInformation *info = payload;
+        agent_information(channel, info);
+        break;
+    }
     case VD_AGENT_FILE_XFER_STATUS:
         file_xfer_handle_status(self, payload);
         break;
-- 
1.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]