[PATCH spice-protocol] RFC: Add VD_AGENT_CAP_ANY_SELECTION_TYPE

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

 



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

When both the client and the agent advertize
VD_AGENT_CAP_ANY_SELECTION_TYPE capability, the existing
VDAgentClipboard messages are modified to embed string
representation of the selection mime type.

Handling arbitrary mime types allows to describe any selection data
type, instead of a limited fixed list. The approach to reuse the integer
representation to extend the type with a registry (like X's atoms) has
been discarded (too complicated without substential benefits)

A string is a \0 terminated utf8 byte array: foo\0
A string[] is a \0\0 terminated array of utf8 strings: foo\0bar\0\0.
---
 spice/vd_agent.h | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/spice/vd_agent.h b/spice/vd_agent.h
index 7464661..2e24c87 100644
--- a/spice/vd_agent.h
+++ b/spice/vd_agent.h
@@ -161,15 +161,6 @@ enum {
     VD_AGENT_ERROR,
 };
 
-typedef struct SPICE_ATTR_PACKED VDAgentClipboard {
-#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */
-    uint8_t selection;
-    uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)];
-#endif
-    uint32_t type;
-    uint8_t data[0];
-} VDAgentClipboard;
-
 enum {
     VD_AGENT_CLIPBOARD_NONE = 0,
     VD_AGENT_CLIPBOARD_UTF8_TEXT,
@@ -179,12 +170,29 @@ enum {
     VD_AGENT_CLIPBOARD_IMAGE_JPG,  /* optional */
 };
 
+typedef struct SPICE_ATTR_PACKED VDAgentClipboard {
+#if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */
+    uint8_t selection;
+    uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)];
+#endif
+#if 0 /* VD_AGENT_CAP_ANY_SELECTION_TYPE */
+    string type;
+#else
+    uint32_t type;
+#endif
+    uint8_t data[0];
+} VDAgentClipboard;
+
 typedef struct SPICE_ATTR_PACKED VDAgentClipboardGrab {
 #if 0 /* VD_AGENT_CAP_CLIPBOARD_SELECTION */
     uint8_t selection;
     uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)];
 #endif
+#if 0 /* VD_AGENT_CAP_ANY_SELECTION_TYPE */
+    string[] types;
+#else
     uint32_t types[0];
+#endif
 } VDAgentClipboardGrab;
 
 typedef struct SPICE_ATTR_PACKED VDAgentClipboardRequest {
@@ -192,7 +200,11 @@ typedef struct SPICE_ATTR_PACKED VDAgentClipboardRequest {
     uint8_t selection;
     uint8_t __reserved[sizeof(uint32_t) - 1 * sizeof(uint8_t)];
 #endif
-    uint32_t type;
+#if 0 /* VD_AGENT_CAP_ANY_SELECTION_TYPE */
+    string type;
+#else
+    uint32_t type; /* string type; */
+#endif
 } VDAgentClipboardRequest;
 
 typedef struct SPICE_ATTR_PACKED VDAgentClipboardRelease {
@@ -218,6 +230,7 @@ enum {
     VD_AGENT_CAP_GUEST_LINEEND_LF,
     VD_AGENT_CAP_GUEST_LINEEND_CRLF,
     VD_AGENT_CAP_MAX_CLIPBOARD,
+    VD_AGENT_CAP_ANY_SELECTION_TYPE,
     VD_AGENT_END_CAP,
 };
 
-- 
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]