[Spice-devel] unclear main-channel documentation

Christophe Fergeau cfergeau at redhat.com
Wed Aug 31 15:37:59 UTC 2016


Hey,

On Thu, Aug 18, 2016 at 10:49:51PM +0300, Alex Roithman wrote:
> Documentation is still not clear. It is impossible to understand how to
> call the guest request to get the data selection from client clipboard.
> 
> About: spice-client-glib, 'main-clipboard-selection-request' signal. In
> which cases this signal can be emitted?..
> How to use the spice-client-glib for guest to client copy/paste?

Looking a bit at spice-gtk code, it seems what you are trying to achieve
(copy from client to guest) is done through
spice_gtk_session_copy_to_guest().

First it calls gtk_clipboard_request_targets() to get the list of
targets supported by the current clipboard, and then passes these
targets to spice_main_clipboard_selection_grab() after some marshalling
of the list.

spice_main_clipboard_selection_grab() is going to send data to the
agent. Then spice-gtk will receive a VD_AGENT_CLIPBOARD_REQUEST from the
agent, which will cause the "main-clipboard-selection-request" signal to
be emitted.

clipboard_request() in spice-gtk will then call
gtk_clipboard_request_contents() to get the client clipboard content,
and will then call spice_main_clipboard_selection_notify() in order to
send it.

keep in mind that parts of this may be inaccurate/wrong, as I'm not
fully familiar with that clipboard code.


Hope that helps,

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160831/01455fb7/attachment.sig>


More information about the Spice-devel mailing list