[Spice-devel] paste client clipboard selection to guest

Alex Roithman kaperang07 at gmail.com
Tue Jun 7 17:41:57 UTC 2016


i checked some clipboard actions in one same virtual machine. The different
in usage clipboards in the virt-viewer (Remote Viewer) app and the my app
is that:
[In virtual machine console]:
$ kill -9 </usr/bin/spice-vdagent>
$ /usr/bin/spice-vdagent -d -x
......
spice-vdagent[.....]: 0x24f1010 received clipboard data, arg1: 0, arg2: 1,
size 26
spice-vdagent[.....]: clipboard: received clipboard data without an
outstanding selection request, ignoring
......
screenshot of case
<https://f1ash.fedorapeople.org/Pictures/clipboard_fail_example.png>

As i think:
arg1=0 (arg in code VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD)
arg2=1 (arg in code VD_AGENT_CLIPBOARD_UTF8_TEXT)
size=26 (size of received text)
It is accords with code and matches the usage case, but spice-vdagent
dropped received data.

Then i have the question: how to emit this request (i think this
“main-clipboard-selection-request”)?

On 14 May 2016 at 10:58, Alex Roithman <kaperang07 at gmail.com> wrote:

>
> ---------- Forwarded message ----------
> From: Alex Roithman <kaperang07 at gmail.com>
> Date: 13 May 2016 at 22:13
> Subject: Re: [Spice-devel] paste client clipboard selection to guest
> To: Christophe Fergeau <cfergeau at redhat.com>
>
>
> Yes, in remote-viewer and virt-manager copy/paste works.
>
> I try to implement spice viewer using spice-client-glib-2.0.
> Video, sound, send files, copy selections from guest to host -- works.
> One problem: paste from host clipboard to guest.
> It is a code place: .../vm_viewer/qspice_widgets/qspice-main-channel.cpp#L306
> .
> <https://github.com/F1ash/qt-virt-manager/blob/master/src/vm_viewer/qspice_widgets/qspice-main-channel.cpp#L306>
>
> How i implement it:
> just read data from QClipboard, then set appropriate data type
> and call spice_main_clipboard_selection_notify(...) with this data
> by clipboardSelectionNotify() method.
> I check when the guest clipboard was released, but not works too.
>
> On 13 May 2016 at 18:54, Christophe Fergeau <cfergeau at redhat.com> wrote:
>
>> Hey,
>>
>> On Mon, Apr 18, 2016 at 06:26:29AM +0300, Alex Roithman wrote:
>> > I can't implement paste data to the guest.
>> >
>> > spice_main_clipboard_selection_notify()
>> > don't send data to guest even if implement
>> > as:
>> >
>> >     spice_main_clipboard_selection_notify(
>> >                 (SpiceMainChannel *) gobject,
>> >                 VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD,
>> >                 type,
>> >                 (const guchar*)"153",
>> >                 3);
>> >
>> > I read in
>> >
>> > http://www.spice-space.org/page/Whiteboard/AgentProtocol#Clipboard
>> >
>> http://www.spice-space.org/docs/spice-gtk/SpiceMainChannel.html#SpiceMainChannel-main-clipboard-selection-request
>> >
>> > that sending possible if guest clipboard released
>> > and client clipboard data requested.
>> > But i don't know how to emit request signal for this.
>> > Maybe i not understand the logic of clipboard data moving.
>> > Need help or detail description. :)
>>
>> Can you be more specific about what you are doing?
>> Do you have an application based on spice-gtk or spice-glib? Have you
>> checked how spicy (for example) handles copy and paste? Or are you
>> trying to do something special which spicy/remote-viewer are not doing?
>>
>> Also, I assume you checked that with the applications mentioned above,
>> copy and paste works? (ie the agent is running in the guest, and working
>> as expected, it's only a problem with your code?)
>>
>> Christophe
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160607/a236aa2a/attachment-0001.html>


More information about the Spice-devel mailing list