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.
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.