[Xquartz-dev] Making it less ambiguous - Copy/Paste Problem

Jeremy Huddleston jeremyhu at apple.com
Thu Sep 11 19:50:33 PDT 2008


On Sep 11, 2008, at 18:12, Jordan K. Hubbard wrote:
> That isn't, however, quite what George and I had in mind.  What we had
> in mind would look more like this:
>
> 1) select text in the TK Widget
> PRIMARY="Owned by TK" CLIPBOARD=NULL PASTEBOARD=NULL
> 1a) Do X11.app's Edit->Copy
> PRIMARY="Owned by TK" CLIPBOARD=NULL PASTEBOARD="TK Text 1"
> 2a) do edit->copy in gimp
> Proxy notices change to CLIPBOARD and copies to PRIMARY, becoming
> owner of PRIMARY

This just seems bizarre to me.  Now you're changing PRIMARY because  
someone set CLIPBOARD.
"Why does my xterm selection disappear when I do Edit->Copy in gimp?"

> 2b) Since we only pay attention to PRIMARY in copy-to-pasteboard
> operations now:
> PRIMARY="Owned by Proxy" CLIPBOARD="Owned by Gimp" PASTEBOARD="GIMP
> IMAGE"
>
> 3) select new text in TK Widget
> PRIMARY="Owned by TK" CLIPBOARD="Owned by Gimp" PASTEBOARD="GIMP  
> IMAGE"
> 3a) Do X11.app's Edit->Copy
> PRIMARY="Owned by TK" CLIPBOARD="Owned by Gimp" PASTEBOARD="Tk
> text" (since, again, we are only looking at PRIMARY).
>
> So, in essence, the CLIPBOARD becomes irrelevant to the copy-to-
> pasteboard operation since the proxy simply takes care to copy the
> CLIPBOARD to PRIMARY when an application only sets the former.

This introduces a weird "PRIMARY changes when CLIPBOARD is set"  
problem without really addressing any specific issue in the case that  
I presented.  George's only issue was that if an app changes what it  
is in it's CLIPBOARD without actually explicitly doing an  
XSetSelectionOwner (or whatever it is that will cause other apps to  
see that it has done this), then we won't "notice" the change.  Your  
solution here does not address that particular problem (additionally,  
I think we should not worry about addressing that problem).

Additionally, this particular issue can be solved by making pbproxy  
greedy for CLIPBOARD.  And we have:

On CLIPBOARD is stolen event:
	if option_proxy_clipboard:
		Copy data from CLIPBOARD owner to PB
		if not option_proxy_pb_to_clipboard: // because this is done by the  
PB change event handler if we are
			Copy data from CLIPBOARD owner to pbproxy buffer
			Claim ownership of CLIPBOARD

this is the more in-depth implementation of my original which  
addresses George's concern:

> Event CLIPBOARD changed:
> 	if option_proxy_CLIPBOARD:
> 		CLIPBOARD -> PB


>  It
> also becomes essentially impossible for an X11 app to own both
> CLIPBOARD and PRIMARY with different contents in each, which I
> consider a feature rather than a bug on our platform since that's just
> confusing and we're essentially forcing X11 users to face the fact
> that they're on a Mac.

Well, it also causes selected text to just become unselected "for no  
reason" and I actually consider this a bug rather than a feature.  I  
am of the mind that X11 should behave like X11 on its own and the  
pbproxy code should not introduce any behavior such as this.

> I also think it's fairly close to what you suggested a few rounds ago,
> so where's the flaw in that thinking?

Yeah, I think at one point I did suggest that.  But I no longer  
agree.  We can address the problem without actually introducing this  
oddity.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3221 bytes
Desc: not available
Url : http://lists.macosforge.org/pipermail/xquartz-dev/attachments/20080911/aac8c3cf/attachment.bin 


More information about the Xquartz-dev mailing list