Re: Back to copy/paste.
Re: Back to copy/paste.
- Subject: Re: Back to copy/paste.
- From: Harald Hanche-Olsen <email@hidden>
- Date: Fri, 18 Apr 2008 23:09:22 +0200 (CEST)
+ Harald Hanche-Olsen <email@hidden>:
> I'll rerun my experiments more carefully when I find some spare time
> later in the (European) day.
I am doing that now, and what I find is intriguing to say the least.
My first description was definitely too simple: It did not take
enough variables into account. Or rather, it did not take the right
variables into account.
So I try again. This time around, I am using this mailing list, but
later I may see about getting an account on x.org and editing the
wiki page.
It is more important to understand two particular bits of state than
where and how the data moves: If you understand those two bits, then
data movement is easy. Here are the two bits:
- does quartz-wm hold the PRIMARY selection?
- does quartz-wm hold the CLIPBOARD selection?
Note that it is the X server's job to keep track of which client (if
any) is the current holder of either selection.
If you get these two bits straight, data movement from pasteboard to
X11 is easily understood:
Whenever quartz-wm is asked to supply either selection, it serves the
current contents of the pasteboard. That is why, whenever quartz-wm
holds a selection, any changes in pasteboard contents are immediately
reflected in the X11 world. Note that quartz-wm does not store any
pasteboard or selection data on its own; it just relays these data.
So we need to understand those two bits. As far as I can tell, only
two types of events change them:
1. When X11 gains focus, then if the pasteboard has been recently
updated (I'm still a bit fuzzy on exact circumstances), then
quartz-wm claims both PRIMARY and CLIPBOARD selections.
2. Whenever any X11 client claims either of the two selections, if
that selection is held by quartz-wm then it loses that selection,
but it appears to immediately claim the other one. (Seems like a
bug to me.)
3. Whenever X11 loses focus, if an X11 client other than quartz-wm
holds the CLIPBOARD selection the quartz-wm asks for it and puts it
on the pasteboard. It also appears to grab the PRIMARY selection at
the same time. If another X11 client now claims the PRIMARY
selection for itself, then quartz-wm does NOT claim the CLIPBOARD
one. The is is the only exception to rule 2 that I have observed,
and seems to be only way that quartz-wm can end up holding no
selection.
Er no, there is another way: If an X11 client claims the clipboard
while X11 does not have focus, then the focus comes back to X11 and
leaves again, the new clipboard is copied to the pasteboard, but
quartz-wm does not claim the primary selection as stated above.
Go figure.
Big caveat: Recall that X11 -> Edit -> Copy changes the rules of the
game irreversibly. The above observations pertain to the situation
before this «original sin». I haven't investigated much yet what
happens after.
I am beginning to feel the need to study the code that Ben made public
earlier, to correlate it with what I am observing. But I find it hard
to read. What language is it? Never mind, it looks enough like C that
I suppose I can figure out the important bits. Later. Now I have used
up all today's available time.
- Harald
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden