[Xquartz-dev] Proposal for PRIMARY and CLIPBOARD Copy/Paste

George Peter Staplin georgeps at xmission.com
Thu Sep 11 17:58:07 PDT 2008


Quoted Jeremy Huddleston <jeremyhu at apple.com>:

>
> On Sep 11, 2008, at 16:18, George Peter Staplin wrote:
>
>> Quoted Jeremy Huddleston <jeremyhu at apple.com>:
>>
>>> Ok, my original response was over iPhone, so I couldn't really
>>> elaborate too much...  here's the basic logic/pseudocode for how this
>>> should work:
>>>
>>> Event PRIMARY changed (ie someone selected new text):
>>> 	if option_proxy_on_select:
>>> 		PRIMARY -> PB

How do you detect the selection when not every toolkit will set the  
selection owner when text changes?  I think it's asking for trouble to  
have every toolkit set the owner after a change.  We'd have to  
probably patch Tk, Motif, and lots of legacy apps.  Some of which may  
be compiled statically and running remotely...

>>> Event X11.app Edit->Copy menu item:
>>> 	PRIMARY -> PB
>>>
>>> Event CLIPBOARD changed:
>>> 	if option_proxy_CLIPBOARD:
>>> 		CLIPBOARD -> PB

How do you detect that?  You have to do an XConvertSelection to see if  
it has changed, and process the SelectionNotify...  We can detect when  
the owner changes, but not when the actual contents have changed,  
unless we retrieve the contents.

>>> Event PB updated:
>>> 	if option_proxy_pb_to_clipboard:
>>> 		PB -> CLIPBOARD (this involves "grabbing" the CLIPBOARD)
>>> 	if option_proxy_pb_to_primary:
>>> 		PB -> PRIMARY (essentially same as above)
>>>
>>> Event server asks for PRIMARY/CLIPBOARD:
>>> 	get what's in PB and return
>>
>> This won't work correctly in some cases from what I see.  The
>> CLIPBOARD and PRIMARY selections are just owned.  And once owned it
>> seems not all X11 apps will set ownership again (e.g. Tk and possibly
>> others).  They don't technically have to.  So we have the same
>> ambiguous situation as before.
>
> We don't care if TK "resets" that it owns PRIMARY.  Primary is proxied
> on the Edit->Copy event, so the "new" value is proxied even if it
> doesn't "reassert" its claim on the second selection.

I think our images of how this works differ, but I'm not certain how  
to clarify my image, and understand yours better.

> As far as CLIPBOARD goes... I think most people concerned with
> CLIPBOARD will be using GTK which doesn't exhibit this problem... but
> your "make pbproxy proxy/cache/reclaim CLIPBOARD" approach might work
> here as a solution.  But you should definitely not do that for PRIMARY
> (since it would cause selected text to always unselect).

I don't know.  To me it seems simpler now to add 2 menu items.

1. PRIMARY=None CLIPBOARD=None PB=unknown
    select text in a text widget
2. PRIMARY=textWindow CLIPBOARD=None PB=unknown
    Gimp image copy via an Edit->Copy menu item
3. PRIMARY=textWindow CLIPBOARD=imageWindow PB=unknown
    XQuartz Edit->Copy

What do we copy?


1. PRIMARY=None CLIPBOARD=NONE PB=unknown
    Gimp image copy via Edit->Copy menu item
2. PRIMARY=None CLIPBOARD=imageWindow PB=unknown
    select text in a text widget
3. PRIMARY=textWindow CLIPBOARD=imageWindow PB=unknown
    XQuartz Edit->Copy

What do we copy?


Regards,

George
-- 
http://www.xmission.com/~georgeps/  http://whim.linuxsys.net
http://code.google.com/p/megapkg/


More information about the Xquartz-dev mailing list