Comment 60 for bug 21202

Revision history for this message
Tralalalala (tralalalala) wrote : Re: firefox doesn't work with gtk clipboard management

@markor:
Like Arthur said: "Using Glipper is a workaround." Glipper is a clipboard manager which keeps a list of previous clipboard items. When you copy something Glipper saves the copied text into a file which is located in a hidden directory within your homedirectory. This file is just a text file, so Glipper doesn't work with images.

To test this, do the following:
- Start Firefox;
- Click with the right mouse button on an image and choose to copy this image;
- Keep Firefox open and now start The GIMP;
- Click on "Acquire" and choose "Paste as New";
- The image was on the clipboard, so it could be pasted as a new file.

Now do the following:
- Close The GIMP and go back to Firefox;
- Click with the right mouse button on an image and choose to copy this image;
- Now close Firefox BEFORE you start The GIMP;
- Click on "Acquire" and choose "Paste as New";
- The image wasn't found on the clipboard, so it couldn't be pasted as a new file.

The same behavior appears with text if you don't use a clipboard manager. To test it, disable Glipper and do the following:
- Start Firefox;
- Select some text within Firefox and copy this text;
- Close Firefox and now start Gedit;
- Try to paste the text you've copied;
- The text wasn't found on the clipboard, so it couldn't be pasted into Gedit (if you click with your right mouse button, you'll see the option called "paste" is greyed out, so it isn't available anymore, because the clipboard is empty).

@John Vivirito:
Read my reply to markor for steps to reproduce this bug.

How copy/paste works in X:
http://www.jwz.org/doc/x-cut-and-paste.html

The old way of copy paste was:
- Select some text;
- Click with the middle mouse button to paste.

This still works:
- Select some text on this page;
- Go to the Comment field at the end of this page;
- Press middle mouse button.

Selecting some text is the copy process and pressing the middle mouse button is the paste process. If you close the application that holds the selected text, you can't paste it anymore.

Most people are used to the way copy/paste works in Windows. It's also implemented in Linux, but it doesn't work in the same way. In Windows you can close an application and Windows remembers the text or picture you copied.

In copy/paste still works the same as the old way of selecting and middle clicking:
- Select some text and copy it (actually it's the same as only selecting the text without copying it);
- Paste it elsewhere (actually it's the same as pressing the middle mouse button).

Instead of copying the text to the a clipboard and remembering the contents of this clipboard till some other application overwrites the contents, the process still works like the old way of selecting and middle clicking: you still have to keep the application open in order to be able to paste the text elsewhere.

I found this blog which describes how it works:
http://elliotth.blogspot.com/2008/08/desktop-linux-suckage-clipboard.html

It says:
"The way it works is that it's more like a token that gets handed round. So if you copy in Firefox and paste Rhythmbox, what happened was that at copy-time Firefox said "if anyone wants the contents of the clipboard, they should ask me", and at paste time Rhythmbox asked "who has the clipboard contents?", was told "Firefox", and asked Firefox "could I have the clipboard contents?". Which is all nice and efficient, saving unnecessary copying... until someone copies, quits, and tries to paste. Now the application with the data is no longer running, so it's gone.

This is not how a clipboard should work."

Gnome fixed this for their own applications (like Gedit), so you can copy something, then close the application and paste it into another application. The problem is a lot of applications don't use this way of copy/paste which Gnome uses (the freedesktop.org way), but still use the old way.

Even if Firefox uses freedesktop.org specifications of copy/paste, the problem is solved only for one application. There are a lot of other applications which use the old way of copy/paste. To completely fix this bug there are two ways:
- Rewrite / patch every application that doesn't work in the right way;
- Use a clipboard manager which remembers what has been copied.

Glipper and Klipper are clipboard managers for Gnome and KDE. They write copied text to a file in your homedirectory. When using Glipper or Klipper you can always paste, even after closing the application, even after a reboot.

Unfortunately there are also pronlems with these applications:
- The file which keeps your history is text file, so these applications don't work with pictures or sound;
- Bugs when copying/pasting charts into OpenOffice.org;
- Errors about not being able to add Glipper to the panel after a reboot.

A few weeks ago I discoverd Desktop Data Manager:
http://data-manager.sourceforge.net/

This application can also handle pictures. You can copy an image, close Firefox and paste the image in The GIMP. After doing so, you can select a part of the picture in GIMP, copy it and paste it to your Desktop to save it.

In my opinion the only disadvantage of this application is, it comes with a download manager which I don't use.

Maybe it's possible to use some parts of Desktop Data Manager in future versions of Ubuntu, so copy/paste will work for all applications, everytime. Best way ofcourse is to copy the users selection to a builtin clipboard directly when a user chooses to copy something, instead of keeping the old way of waiting for an application to ask for the selection. Well, I don't know how you're going to fix it, but this bug really has to be fixed soon. An operating system just has to have a copy/paste function that works everytime, everywhere and for everything that can be copied (text, pictures, sound, files).