[PATCH spice-gtk 5/5] main: send max-clipboard to agent

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

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

Send configured max-clipboard size to the agent, after receiving agent
capabilities.

See also spice-protocol patch description:
http://lists.freedesktop.org/archives/spice-devel/2013-November/015254.html
---
 gtk/channel-main.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 2887208..d4a0246 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -196,6 +196,7 @@ static const char *agent_caps[] = {
     [ VD_AGENT_CAP_SPARSE_MONITORS_CONFIG ] = "sparse monitors",
     [ VD_AGENT_CAP_GUEST_LINEEND_LF    ] = "line-end lf",
     [ VD_AGENT_CAP_GUEST_LINEEND_CRLF  ] = "line-end crlf",
+    [ VD_AGENT_CAP_MAX_CLIPBOARD       ] = "max-clipboard",
 };
 #define NAME(_a, _i) ((_i) < SPICE_N_ELEMENTS(_a) ? (_a[(_i)] ?: "?") : "?")
 
@@ -1210,6 +1211,16 @@ static void agent_display_config(SpiceMainChannel *channel)
 
 /* any context: the message is not flushed immediately,
    you can wakeup() the channel coroutine or send_msg_queue() */
+static void agent_max_clipboard(SpiceMainChannel *channel)
+{
+    SpiceMainChannelPrivate *c = channel->priv;
+    VDAgentMaxClipboard msg = { .max = c->max_clipboard};
+
+    agent_msg_queue(channel, VD_AGENT_MAX_CLIPBOARD, sizeof(VDAgentMaxClipboard), &msg);
+}
+
+/* any context: the message is not flushed immediately,
+   you can wakeup() the channel coroutine or send_msg_queue() */
 static void agent_announce_caps(SpiceMainChannel *channel)
 {
     SpiceMainChannelPrivate *c = channel->priv;
@@ -1849,9 +1860,15 @@ static void main_agent_handle_msg(SpiceChannel *channel,
         if (test_agent_cap(self, VD_AGENT_CAP_DISPLAY_CONFIG) &&
             !c->agent_display_config_sent) {
             agent_display_config(self);
-            agent_send_msg_queue(self);
             c->agent_display_config_sent = true;
         }
+
+        if (test_agent_cap(self, VD_AGENT_CAP_MAX_CLIPBOARD)) {
+            agent_max_clipboard(self);
+        }
+
+        agent_send_msg_queue(self);
+
         break;
     }
     case VD_AGENT_CLIPBOARD:
-- 
1.8.3.1

_______________________________________________
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]