wxGTK TheClipboard

Hello,

I am trying to use the primary selection under X11 (gtk) and am noticing some strange behavior. To my understanding there is supposed to be two clipboards the normal one used with cut/copy/paste and the primary selection that holds the value of what is selected. It seems however that only one can be available at any time. The code in the included sample will put text in the primary selection when it is selected with the mouse, and Ctrl+C will use the normal clipboard. The sample has a toolbar to show the status of the clipboard the paste icon will be grayed out when there is nothing on the clipboard and enabled else-wise.

Selecting text and using the primary selection works fine to allow for pasting of with the middle mouse button to other windows, then a Ctrl+C to put the same text in the regular clipboard also works, but if you then select some different text to put a new selection in the primary selection it will delete anything thats on the regular clipboard causing the paste button to be disabled. It seems that it should be possible to have both a primary selection and the normal clipboard available. Is there something wrong with the code I have, am I misunderstanding this behavior, or is this a bug?

clipboardtest.py (2.24 KB)

Cody Precord wrote:

Hello,

I am trying to use the primary selection under X11 (gtk) and am noticing some strange behavior. To my understanding there is supposed to be two clipboards the normal one used with cut/copy/paste and the primary selection that holds the value of what is selected. It seems however that only one can be available at any time. The code in the included sample will put text in the primary selection when it is selected with the mouse, and Ctrl+C will use the normal clipboard. The sample has a toolbar to show the status of the clipboard the paste icon will be grayed out when there is nothing on the clipboard and enabled else-wise.

Selecting text and using the primary selection works fine to allow for pasting of with the middle mouse button to other windows, then a Ctrl+C to put the same text in the regular clipboard also works, but if you then select some different text to put a new selection in the primary selection it will delete anything thats on the regular clipboard causing the paste button to be disabled. It seems that it should be possible to have both a primary selection and the normal clipboard available. Is there something wrong with the code I have, am I misunderstanding this behavior, or is this a bug?

It's a bug that's been there forever, basically wxGTK only has one wxDataObject that it uses to hold the value for either the Primary Selection or the regular Clipboard. It's apparently been fixed in 2.9, but I haven't checked that yet.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!