Comment 37 for bug 69613

Revision history for this message
In , Mozbugz (mozbugz) wrote :

(From update of attachment 384458)
Thank you, Rickard for submitting the patch.

It looks like gtk_clipboard_store() is a suitable function to use, but I don't
think we should be using it so often.

My reading of http://freedesktop.org/wiki/ClipboardManager is that it is
intended that the app should only ask the clipboard manager to save the
clipboard when the app is about to exit. I think the following clauses imply
this:

  "If a client needs to exit while owning the CLIPBOARD selection, it should
   request the clipboard manager to take over the ownership of the clipboard,
   using the SAVE_TARGETS mechanism."

   "the clipboard owner will quit upon receiving the SelectionNotify"

It looks like gtk_clipboard_store() passes ownership to the clipboard manager
immediately, and I don't think we want to do this every time
nsClipboard::SetData is called with new data for the CLIPBOARD.

Saving the clipboard involves converting the data (possibly of significant size) to a number of different target formats and transferring each of these (possibly across a network) to the manager.

The clipboard manager may even prompt to check whether the user really wants
to do this. (The spec says "possibly refusing to save large amounts of data,
or asking the user before doing so".)