Comment 212 for bug 11334

Revision history for this message
In , Pyrates (pyrates) wrote :

I think in terms of "fixing" this flaw, we need to be very careful. We need to design it out thoroughly so that we're not "fixing" it down the road. I'd like to think of it like designing the specs for ssl.

It has to have following:

1. Cut/Copy without needing to keep the source open to then paste it
2. Disable global selection based copy because that just messes people up who try to delete some text by highlighting it first. Individual applications can still implement it if they wish.
3. To cut/copy and then paste has to be explicit using the keyboard shortcuts like ctrl+c, ctrl+x, and ctrl+v.
4. It can also be done using cut, copy, and paste in a menu like under edit like it is in Windows and OS X.
5. Keyboard shortcuts can be overridden to do something else if the application wants to. An example is putty in windows where it does have selection based copy and right clicking does a paste. The keyboard shortcuts are then overridden to have other functions or disabled entirely in putty and instead are used for terminal commands like ctrl+c forces the current program you're running in there to quit.
6. The api for cut, copy, and paste will by default use the standard keyboard shortcuts but allow the author of the application to disable that portion of it and allow them to specify another method to do the cut, copy, and paste. This will keep developers that are coming from windows and OS X happy since they won't have to do much to get it working.

Copying the data to the clipboard:

1. The clipboard in Xorg will specify a maximum size that can be used for the clipboard.
2. When data is sent to the clipboard, it will include what kind of data it is, and the program it came from. This is so that with certain kinds of data, there can be special instructions in dealing with it. For example copying a file doesn't require you copy the whole file into memory, but merely the location of where the file is and the name of the file. It can also include special instructions that the program has to remain open for the data to remain in the clipboard.
3. The clipboard will send an acknowledgment back it now has the data.
4. That data will have a unique id assigned to it.
5. If the data is under the size limit, it will send that acknowledgment as usual.
6. If the data is over the size limit, it will send an acknowledgment to the program that says the program has to confirm it wants the clipboard to store that much data. The program can do this automatically if it expects to be copying large chunks of data into the clipboard, or it can do it manually by asking the user to confirm it.
7. Once the clipboard has that confirmation from the program, it will attempt to store the data it is asked to.
8. If there is still a problem with storing that much data, it will send an acknowledgment with the reasons why it can't store that much data, such as not enough ram.
9. The program can also truncate the data if it is over the limit when copying it to the clipboard as well.

Copying data from the clipboard back into the same program or another program:

1. Using the api for pasting the data, the clipboard will automatically empty itself if the data had used the cut method instead of copy method to be copied into the clipboard.
2. If the data had been copied to the clipboard instead of using cut, then it will remain in the clipboard after being pasted. The exception being is if its a certain type that specifies the program that the data came from has to remain open in order to paste it.
3. When the api for pasting the data is called, it will automatically know the unique id that was assigned to that data without the programmer having to specify it.
4. The clipboard will keep track of data copied into it and all management associated with it. It will handle only one piece of data at a time. This can be expanded at a later time if needed to support multiple pieces of data into the clipboard.
5. If a program has copied a large amount of data into the clipboard that was over the initial limit allowed and acknowledged it wanted that data copied, upon the exit of that program, it is responsible for checking if it still has data in the clipboard. The clipboard because it kept the name of the program that copied the data into it, the api for this check will not require the author of the program to pass that data, it will automatically be passed while calling the api. The clipboard when this check is done will return the data type and the size of it. If there is data that exists in the clipboard that was over the limit allowed, the program will then ask the user if they want to remove it from the clipboard or keep it. The program can also instead automatically remove this data so it doesn't have to ask every time should the above conditions be true. This check that is done will only be for data that was over the limit, not for any data that was under the limit.

Program example with putty:

1. Changes the clipboard keyboard shortcuts so they are used for linux type terminal commands.
2. Copy is done via doing a highlight of selection of text.
3. Paste is done via doing a right click inside the putty window.
4. Putty does not use cut at all.

Program example with adobe audition:

1. Does cut, copy and paste as normal.
2. When exiting, it checks if there is data it copied to the clipboard that was over the limit allowed.
3. If there is, it asks the user if they want to empty the clipboard or not with yes being highlighted by default.

If you want to create a spec based on the above, feel free to. It should be on a wiki so that we can all collaborate on it.