Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have recently read about how Xorg is to blame for the infamous bug in which a user cannot copy and paste from a window after they have closed it. And I also know about the planned eventual switch to Wayland as a replacement for X.

If this bug is a result of X, and X will be replaced by Wayland, then is it possible that a fix will come at that time? I'm curious as to whether this is technically possible, and if it's currently in the plans for it.

share|improve this question
It's very very much too soon to even know if Wayland will completly replace X – Uri Herrera Sep 14 '11 at 3:39
You do realize you can just use something like parcellite and the clipboard of will be saved after the windows get closed. – Hugo Jul 13 '12 at 14:12
up vote 4 down vote accepted

Well, I don't think it's a bug as such, it's rather a feature which has some unintended consequences :) Moreover, my understanding is that other "clipboard managers", i.e. in Windows and MacOS X, work in a very similar way - when Copy operation is performed, the application just notifies the clipboard manager - "hey, I've got something" without passing the actual data (although in the above mentioned OSes an application can physically store data in the clipboard - XWindow leaves this to a "clipboard manager", which is a separate application).

The reason for this will become clear if you consider that the data copied often needs to be converted from one format to another before being pasted. Example: you're copying a text frame from a publishing program and paste it into the same program - the result preserves the text frame size, borders, transformations etc. Then you paste the same thing into a text processor - the result is some text with rich formatting but obviously the text frame properties are lost because the text processor knows nothing about this. Then you paste the same thing into a text editor - the result is just plain text without any formatting.

Now, how does it work? How does proprietary data format of the publishing program is getting converted to something which the text processor understands or just to plain text? Obviously, the conversion can't be done by the X server because it knows nothing about all the possible data formats, also, the receiving application can't do the conversion for the same reason.

My understanding of the process is that when something is copied, the application notifes the clipboard manager about the formats in which it can provide the data: "hey, I've got something which I can convert to my-proprietary-format, rich text or plain text".

Other application then checks if there's anything in the clipboard in a format which it understands:

if (clipboad.contains_data_in_formats("image", "rich text", "plain text")) {

Then, when Paste action is selected, the end result is that the source application is asked to provide the data in the required format.

When the application is exiting, the standard says it can save the data in the clipboard manager:

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. If there is no 
clipboard manager, or if the SAVE_TARGETS conversion fails, the 
application should simply exit.

So, my understanding is, it's responsibility of the application to save the data. As such, it's probably unlikely Wayland will improve anything in this respect :)

share|improve this answer
Here's a similar explanation: – Sergey Sep 14 '11 at 4:48
I don't think Windows works that way at all. It provides the clipboard with the data in every format that it wants the data to be available in. – Nathan Osman Oct 19 '11 at 18:13
@George Edison: well, ok, in Windows an application can behave similarly to the logic I described (i.e., render data on request), or, alternatively, to use "send data to clipboard and forget" mode - see SetClipboardData function description in MSDN – Sergey Oct 19 '11 at 23:52
See also WM_RENDERALLFORMATS message - this is Windows equivalent of SAVE_TARGETS. So, if there is a clipboard manager present and applications comply with the specification - from user's point of view, the behaviour of XWindow applications should be the same as on Windows. – Sergey Oct 20 '11 at 0:00
Aaaand... here's how Pasteboard works on MacOS X - only one format is copied, others are provided on request. Which also is somewhat similar to what XWindow does, albeit not completely identical. – Sergey Oct 20 '11 at 0:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.