[Spice-devel] [PATCH] vd_agent: add protocol messages for clipboard/selection-owner model

Arnon Gilboa agilboa at redhat.com
Sun Sep 26 01:06:02 PDT 2010


Alexander Larsson wrote:
> On Tue, 2010-09-21 at 13:54 +0200, Hans de Goede wrote:
>   
>> Hi,
>>
>> On 09/21/2010 09:31 AM, Arnon Gilboa wrote:
>>     
>>> pasting clipboard data is now "only-by-demand" from both sides (client and agent), whose behavior is symmetric.
>>>
>>> -VD_AGENT_CLIPBOARD_GRAB(type) - tell the other side that an application in our side ("we") got ownership of the clipboard.
>>> -VD_AGENT_CLIPBOARD_REQUEST(type) - after we know the other side owns the clipboard (GRAB received), we notify the os we are the owner. when we are asked by the os/app for the clipboard data, we send this REQUEST msg to the other side.
>>> -VD_AGENT_CLIPBOARD(type, data) - the existing message for sending the clipboard, is now sent only in response to REQUEST.
>>> -VD_AGENT_CLIPBOARD_RELEASE - tell the other side that we are no longer the owner of the clipboard (e.g. the owner app was closed).
>>>
>>> this patch will be followed by agent&  client patches handling the above messages.
>>> ---
>>>   spice/vd_agent.h |   13 ++++++++++++-
>>>   1 files changed, 12 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/spice/vd_agent.h b/spice/vd_agent.h
>>> index 9e5adec..0da23aa 100644
>>> --- a/spice/vd_agent.h
>>> +++ b/spice/vd_agent.h
>>> @@ -65,6 +65,9 @@ enum {
>>>       VD_AGENT_CLIPBOARD,
>>>       VD_AGENT_DISPLAY_CONFIG,
>>>       VD_AGENT_ANNOUNCE_CAPABILITIES,
>>> +    VD_AGENT_CLIPBOARD_GRAB,
>>> +    VD_AGENT_CLIPBOARD_REQUEST,
>>> +    VD_AGENT_CLIPBOARD_RELEASE,
>>>       VD_AGENT_END_MESSAGE,
>>>   };
>>>
>>> @@ -121,7 +124,6 @@ enum {
>>>       VD_AGENT_ERROR,
>>>   };
>>>
>>> -//FIXME: size required?
>>>   typedef struct SPICE_ATTR_PACKED VDAgentClipboard {
>>>       uint32_t type;
>>>       uint8_t data[0];
>>> @@ -129,8 +131,17 @@ typedef struct SPICE_ATTR_PACKED VDAgentClipboard {
>>>       
>>>   enum {
>>>       VD_AGENT_CLIPBOARD_UTF8_TEXT = 1,
>>> +    VD_AGENT_CLIPBOARD_BITMAP,
>>>   };
>>>
>>>       
>> Hmm, I'm not sure about this bit, wouldn't it be better to
>> use a string with a mimetype in there, that brings us much
>> larger flexibility. I think this is esp. usefull when the
>> guest as and the client os are the same os, then
>> copying of all kind of things could be .
>>     
>
> Not sure about this, if we want full compatibility with same-os cut and
> paste we need more features anyway, like multiple formats. I think its
> more important to allow some common subset of clipboard types to work
> across os types than supporting all native types.
>
>   
I tend to agree with Alex, and in this case prefer simplicity over 
flexibility, and keep it uint32_t type.


More information about the Spice-devel mailing list