Hi Glynn, > Apart from implementing the CLIPBOARD selection, the application > should implement the SAVE_TARGETS protocol for optimum behaviour with > modern clipboard managers. For details, see:
OK, I've done so (hopefully). > http://www.freedesktop.org/wiki/ClipboardManager After rereading this document, I think I finally got how the mechanism works. Can you confirm this: 0. The clipboard manager acquires the CLIPBOARD_MANAGER and CLIPBOARD selections. 1. My application acquires CLIPBOARD, acting just as if it were PRIMARY. 2. My application wants to exit. Therefore, it 1. Sets a property, say, "MY_SELECTION", to the targets it wants the clipboard manager to preserve the content. 2. Requests the X server to convert the CLIPBOARD_MANAGER selection to SAVE_TARGETS, by passing my application window and the MY_SELECTION property. 3. The clipboard manager gets notified (by a SelectionRequest event) and now queries my application for each target I set MY_SELECTION to. 4. The clipboard manager sends my application a SelectionNotify event with property SAVE_TARGETS (or None if it has failed to save the content) indicating that is has completed 5a. The clipboard manager takes ownership of the CLIPBOARD selection 5b. (parallel to 5a) My application exits In the end, "my application" hopefully is just my function, otherwise I would have to go to subprocesses. Marvin Glynn Clements schrieb: > X itself doesn't have a persistent clipboard. If you want the > clipboard contents to persist after the application terminates, a > clipboard manager must be running. > > Clipboard managers are something of a mixed blessing, so not everyone > uses one. Whether a clipboard manager is in use and its exact > behaviour are dependent upon the desktop environment. All that your > program can do is to implement the relevant protocols; the rest is > beyond its control. > > Apart from implementing the CLIPBOARD selection, the application > should implement the SAVE_TARGETS protocol for optimum behaviour with > modern clipboard managers. For details, see: > > http://www.freedesktop.org/wiki/ClipboardManager > > If a compliant clipboard manager is running, this should cause it to > take over the clipboard (ownership and contents) from the terminating > process. > > Older clipboard managers (and clients) don't support the SAVE_TARGETS > protocol, which means that the clipboard manager must retrieve the > clipboard contents whenever the clipboard changes, which can be > inefficient if the data is large and/or if there are many targets > (some of which may be computationally expensive to generate). > _______________________________________________ xorg@lists.freedesktop.org: X.Org support Archives: http://lists.freedesktop.org/archives/xorg Info: http://lists.freedesktop.org/mailman/listinfo/xorg