[RFC,spice-protocol,1/8] agent: Add new SELECTION messages

Submitted by =?UTF-8?q?Jakub=20Jank=C5=AF?= on May 31, 2018, 8:52 p.m.

Details

Message ID 20180531205225.4266-2-jjanku@redhat.com
State New
Headers show
Series "Clipboard - using MIME types" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

=?UTF-8?q?Jakub=20Jank=C5=AF?= May 31, 2018, 8:52 p.m.
---
 spice/vd_agent.h | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

Patch hide | download patch | download mbox

diff --git a/spice/vd_agent.h b/spice/vd_agent.h
index 7109ede..0d81740 100644
--- a/spice/vd_agent.h
+++ b/spice/vd_agent.h
@@ -91,6 +91,10 @@  enum {
     VD_AGENT_CLIENT_DISCONNECTED,
     VD_AGENT_MAX_CLIPBOARD,
     VD_AGENT_AUDIO_VOLUME_SYNC,
+    VD_AGENT_SELECTION_GRAB,
+    VD_AGENT_SELECTION_REQUEST,
+    VD_AGENT_SELECTION_DATA,
+    VD_AGENT_SELECTION_RELEASE,
     VD_AGENT_END_MESSAGE,
 };
 
@@ -247,6 +251,39 @@  typedef struct SPICE_ATTR_PACKED VDAgentAudioVolumeSync {
     uint16_t volume[0];
 } VDAgentAudioVolumeSync;
 
+/* Following VDAgentSelection* messages are intended as a
+ * more general replacement for VDAgentClipboard* messages.
+ * Selection can be any of VD_AGENT_CLIPBOARD_SELECTION_*
+ * and is always included (unlike VDAgentClipboard* messages).
+ * Type of data is represented by NULL-terminated string (e.g. "TEXT\0").
+ * Agents with VD_AGENT_CAP_SELECTION_DATA must be able to fully handle these.
+ */
+typedef struct SPICE_ATTR_PACKED VDAgentSelectionGrab {
+    uint8_t selection;
+    /* list of advertised targets (MIME types / GdkAtoms)
+     * e.g. "STRING\0TEXT\0UTF8_STRING\0"
+     */
+    uint8_t targets[0];
+} VDAgentSelectionGrab;
+
+typedef struct SPICE_ATTR_PACKED VDAgentSelectionRequest {
+    uint8_t selection;
+    /* requested MIME type of data */
+    uint8_t target[0];
+} VDAgentSelectionRequest;
+
+typedef struct SPICE_ATTR_PACKED VDAgentSelectionData {
+    uint8_t selection;
+    /*  number of bits per data unit */
+    int32_t format;
+    /* the actual data, prefixed by it's MIME type */
+    uint8_t data[0];
+} VDAgentSelectionData;
+
+typedef struct SPICE_ATTR_PACKED VDAgentSelectionRelease {
+    uint8_t selection;
+} VDAgentSelectionRelease;
+
 enum {
     VD_AGENT_CAP_MOUSE_STATE = 0,
     VD_AGENT_CAP_MONITORS_CONFIG,
@@ -263,6 +300,7 @@  enum {
     VD_AGENT_CAP_MONITORS_CONFIG_POSITION,
     VD_AGENT_CAP_FILE_XFER_DISABLED,
     VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS,
+    VD_AGENT_CAP_SELECTION_DATA,
     VD_AGENT_END_CAP,
 };
 

Comments

Hi,

I'm looking to the patches, finally, after having this tested
with you previously. Sorry for the delay!

On Thu, May 31, 2018 at 10:52:18PM +0200, Jakub Janků wrote:
> ---
>  spice/vd_agent.h | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)

The documentation in the structs are fine but I'd welcome some
detail of the messages in the commit log, something like an
example of how it works/is used would be enough.

> diff --git a/spice/vd_agent.h b/spice/vd_agent.h
> index 7109ede..0d81740 100644
> --- a/spice/vd_agent.h
> +++ b/spice/vd_agent.h
> @@ -91,6 +91,10 @@ enum {
>      VD_AGENT_CLIENT_DISCONNECTED,
>      VD_AGENT_MAX_CLIPBOARD,
>      VD_AGENT_AUDIO_VOLUME_SYNC,
> +    VD_AGENT_SELECTION_GRAB,
> +    VD_AGENT_SELECTION_REQUEST,
> +    VD_AGENT_SELECTION_DATA,
> +    VD_AGENT_SELECTION_RELEASE,
>      VD_AGENT_END_MESSAGE,
>  };
>  
> @@ -247,6 +251,39 @@ typedef struct SPICE_ATTR_PACKED VDAgentAudioVolumeSync {
>      uint16_t volume[0];
>  } VDAgentAudioVolumeSync;
>  
> +/* Following VDAgentSelection* messages are intended as a
> + * more general replacement for VDAgentClipboard* messages.
> + * Selection can be any of VD_AGENT_CLIPBOARD_SELECTION_*
> + * and is always included (unlike VDAgentClipboard* messages).
> + * Type of data is represented by NULL-terminated string (e.g. "TEXT\0").
> + * Agents with VD_AGENT_CAP_SELECTION_DATA must be able to fully handle these.
> + */
> +typedef struct SPICE_ATTR_PACKED VDAgentSelectionGrab {
> +    uint8_t selection;
> +    /* list of advertised targets (MIME types / GdkAtoms)
> +     * e.g. "STRING\0TEXT\0UTF8_STRING\0"
> +     */
> +    uint8_t targets[0];
> +} VDAgentSelectionGrab;
> +
> +typedef struct SPICE_ATTR_PACKED VDAgentSelectionRequest {
> +    uint8_t selection;
> +    /* requested MIME type of data */
> +    uint8_t target[0];
> +} VDAgentSelectionRequest;
> +
> +typedef struct SPICE_ATTR_PACKED VDAgentSelectionData {
> +    uint8_t selection;
> +    /*  number of bits per data unit */
> +    int32_t format;
> +    /* the actual data, prefixed by it's MIME type */
> +    uint8_t data[0];
> +} VDAgentSelectionData;
> +
> +typedef struct SPICE_ATTR_PACKED VDAgentSelectionRelease {
> +    uint8_t selection;
> +} VDAgentSelectionRelease;
> +
>  enum {
>      VD_AGENT_CAP_MOUSE_STATE = 0,
>      VD_AGENT_CAP_MONITORS_CONFIG,
> @@ -263,6 +300,7 @@ enum {
>      VD_AGENT_CAP_MONITORS_CONFIG_POSITION,
>      VD_AGENT_CAP_FILE_XFER_DISABLED,
>      VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS,
> +    VD_AGENT_CAP_SELECTION_DATA,
>      VD_AGENT_END_CAP,
>  };

Cheers,
Victor