Hi

On Wed, Mar 3, 2021 at 4:20 PM Gerd Hoffmann <kra...@redhat.com> wrote:

>   Hi,
>
> > > +    if (info != gd->cbinfo[s]) {
> > > +        qemu_clipboard_info_put(gd->cbinfo[s]);
> > > +        gd->cbinfo[s] = qemu_clipboard_info_get(info);
> > > +        gd->cbpending[s] = 0;
> > > +        if (!self_update) {
> > > +            if (info->types[QEMU_CLIPBOARD_TYPE_TEXT].available) {
> > > +                qemu_clipboard_request(info,
> QEMU_CLIPBOARD_TYPE_TEXT);
> >
> > Always requesting the clipboard is a bit harsh, isn't it?
> >
> > +            }
> > > +        }
> > > +        return;
> > > +    }
> > > +
> > > +    if (self_update) {
> > > +        return;
> > > +    }
> > > +
> > > +    if (info->types[QEMU_CLIPBOARD_TYPE_TEXT].available &&
> > > +        info->types[QEMU_CLIPBOARD_TYPE_TEXT].data) {
> > > +        gtk_clipboard_set_text(gd->gtkcb[s],
> > > +
>  info->types[QEMU_CLIPBOARD_TYPE_TEXT].data,
>
> Well, I want gtk deal with the compatibility stuff like all the
> different target names we have for text ("STRING", "text/plain", ...),
> and using gtk_clipboard_set_text() seems to be the only way to do that.
>
> I'm open to better ideas.
>
>
Basically implement an async version of the Gtk function:
https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkclipboard.c#L850

Instead of "gtk_clipboard_set_with_data" taking a copy of the text,
implement the callbacks to request the data from the guest.

I am not sure about gtk_clipboard_set_can_store() interactions, it's
probably only when the application quits by default. I wouldn't worry about
it for now.


-- 
Marc-André Lureau

Reply via email to