[Spice-devel] Spice, VDAgent, and Clipboard

Victor Toso victortoso at redhat.com
Tue Jul 12 06:27:41 UTC 2022


Hi Nick,

On Tue, Jul 05, 2022 at 03:33:33PM -0400, Nick Couchman wrote:
> On Sun, Jul 3, 2022 at 2:40 PM Nick Couchman <vnick at apache.org> wrote:
> 
> > Then, once the clipboard is settled on the client side, I call
> > guac_main_channel_clipboard_selection_notify() to send the data along,
> > followed by guac_main_channel_clipboard_selection_release() to release the
> > previously-called grab:
> >
> > --
> >     /* Send via VNC only if finished connecting */
> >     if (spice_client->main_channel != NULL) {
> >
> > spice_main_channel_clipboard_selection_notify(spice_client->main_channel,
> >             VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD,
> >             VD_AGENT_CLIPBOARD_UTF8_TEXT,
> >             (const unsigned char*) input,
> >             spice_client->clipboard->length);
> >
> > spice_main_channel_clipboard_selection_release(spice_client->main_channel,
> >             VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD);
> >     }
> > --
> >
> >
> To answer my own question, this was the issue - apparently the
> call to spice_main_channel_clipboard_selection_release()
> actually clears the clipboard. Removing this call allows the
> clipboard from client (Guacamole) to Spice server to function
> properly. I'm not sure if there's anything that needs to be
> done to "ungrab" the clipboard after sending the data, or if it
> is done automatically?

IIRC, the "ungrab" on client-side should happen when the Widget
is not on focus anymore. I think it is fine to keep the "grab"
while the widget has focus.

There are several scenarios around this, so it can be a bit
tricky to understand/debug, specially the differences between X11
and Wayland. For example, the comment in owner_change's callback:

    https://gitlab.freedesktop.org/spice/spice-gtk/-/blob/master/src/spice-gtk-session.c#L721

In the past, we used to have some race conditions that I'd bet
you should be hitting with your dev environment but, if you are
not, it should be thanks to the fixes for 
    
    https://gitlab.freedesktop.org/spice/spice-gtk/-/issues/82

Thanks for your interest in SPICE, I'm looking forward to testing
Guacamole (the food I already love!) :)

Cheers,
Victor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20220712/ffb08a66/attachment.sig>


More information about the Spice-devel mailing list