[Xquartz-dev] Copy/Paste ceasing

George Peter Staplin georgeps at xmission.com
Tue Jan 27 09:01:29 PST 2009

Quoted Peter Collinson <pc at hillside.co.uk>:

>> Here's what I do:
>> To copy
>> Cx)	In X11 - point with left button, hold down button and sweep contents

That will work for X11 to X11 pasting, but you really need to tell  
XQuartz it's time to copy by going to the Edit->Copy menu item, so  
that you can paste into a Mac app.

Note: there is a way of enabling an automatic copy of text when  
PRIMARY changes, but it may not work perfectly with all applications.   
The problem is there is no way of knowing when some toolkits have  
changed the selection, if they have previously owned it.  See the  
Pasteboard preferences in the X11 preferences.

>> Cm)	In Mac App - Same as above but use Cmd-C to copy
>> To paste
>> Px)	In X11 - (point where relevant) and middle click mouse
>> Pm)	In Mac - create entry point with left mouse button and Cmd-V
> This has happened again to me. I've re-loaded my coding above to help
> with description.
> What's happening is:
> Cuts from X11 using Cx are pasted correctly in the X11 app world - but
> Pm supplies old contents
> Cms are pasted correctly into both worlds.
> Changing the Cx source to a different X11 app (tried xterm, emacs and
> nedit) makes no difference
> - pasting in the X11 world has the last paste contents but it still
> doesn't change the paste contents in the Mac world.

You really need to use the Edit->Copy menu or the key shortcut after  
selecting text in an X11 app.

> Using Cmd-c or the menu option in place of Cx in the X11 app makes no
> difference.
> Typing pbpaste in the xterm after a Cx (or a Cmd-C) yields the old contents.
> Typing
> 	echo "new contents" | pbcopy
> loads the paste board in both worlds.
> Essentially what seems to be happening is that the copy - presumably
> through the X11 server - has stopped talking
> to the Mac world.

It sounds like the xpbproxy code just hasn't copied the data (text or  
images) from X11 to the Mac NSPasteboard yet.  The X11 copy and paste  
works differently than the Mac.  For instance there is no common way  
to paste into an X11 app, that's why the Paste menu item doesn't exist  
in X11.  An X11 toolkit can implement the paste support using the  
middle mouse buton, or key shortcuts, or menu items, but there is no  
common event or X11 call that will trigger it.

The X11 selection data is usually created on demand, so once a  
requestor has copied the data, it may change or not even exist, and  
the requestor often has no way of knowing if the data has changed  
unless it tries to request it again.  This is why the Edit->Copy is  
required in X11 to copy from X11 to a Mac app.

Note: we have some automatic CLIPBOARD copying that can occur as a  
Pasteboard preference.  It works similarly to xclipboard by using a  
greedy model of copying CLIPBOARD, setting xpbproxy as the owner, and  
doing the same pattern over again, if the CLIPBOARD is lost/owned by  
another application again.


More information about the Xquartz-dev mailing list