[Spice-devel] [PATCH spice-protocol] vd_agent: Add caps for the agent to signal the guest line-ending (rhbz#752350)

agilboa at redhat.com agilboa at redhat.com
Sun Jun 9 06:08:12 PDT 2013


On 06/09/2013 04:06 PM, Hans de Goede wrote:
> Hi,
>
> On 06/09/2013 03:03 PM, agilboa at redhat.com wrote:
>> So conversion is client-only responsibility, while the agent only 
>> needs to advertise its line-ending? seems simpler than conversion in 
>> both sides.
>
> Yep, that is the idea! So the windows agent-side patch for bug 872252
> should be a one liner :)
I like your way of thinking;)
>
> Regards,
>
> Hans
>
>>
>> On 06/05/2013 04:18 PM, Hans de Goede wrote:
>>> When copy and pasting between a Linux guest and a Windows client or 
>>> visa
>>> versa, the line-endings of the text will usually be wrong for the 
>>> other side,
>>> so it is desirable to do automatic conversion.
>>>
>>> However sometimes it is possible for text in the clipboard on Linux 
>>> to have
>>> MSDOS (CRLF) style line-endings, when copy and pasting from Linux to 
>>> Linux
>>> it is undesirable to automatically convert these, since this would 
>>> not happen
>>> when the apps were running directly on the same machine.
>>>
>>> So we want to do automatic conversion only if the client and guest 
>>> native
>>> line-endings differ. This means that we cannot simply define one 
>>> standard
>>> line-ending for VD_AGENT_CLIPBOARD_UTF8_TEXT data.
>>>
>>> Given the above it makes sense to only do conversion on one end. This
>>> patch adds new capabilities which allow the guest-agent to advertise 
>>> what
>>> is the native line-ending of the guest.
>>>
>>> This should be used by the client in the following way:
>>> 1) Check if the guest-agent advertises any line-ending type at all, 
>>> if not
>>> the guest line-ending is unknown -> do not convert
>>> 2) If the guest's native line-ending matches that of the platform 
>>> the client
>>> is running on, then do no not convert
>>> 3) If the guest's native line-ending is different from the client 
>>> platform,
>>> then convert received clipboard data into the client platform's native
>>> line-ending, and convert clipboard data which will be send to the 
>>> guest-agent
>>> into the guest's native line-ending.
>>>
>>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>>> ---
>>>   spice/vd_agent.h | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/spice/vd_agent.h b/spice/vd_agent.h
>>> index 1c4ebaf..c331d84 100644
>>> --- a/spice/vd_agent.h
>>> +++ b/spice/vd_agent.h
>>> @@ -207,6 +207,8 @@ enum {
>>>       VD_AGENT_CAP_CLIPBOARD_BY_DEMAND,
>>>       VD_AGENT_CAP_CLIPBOARD_SELECTION,
>>>       VD_AGENT_CAP_SPARSE_MONITORS_CONFIG,
>>> +    VD_AGENT_CAP_GUEST_LINEEND_LF,
>>> +    VD_AGENT_CAP_GUEST_LINEEND_CRLF,
>>>       VD_AGENT_END_CAP,
>>>   };
>>



More information about the Spice-devel mailing list