xwinclip comment

Harold Hunt huntharo@msu.edu
Wed Jan 23 05:43:00 GMT 2002


Originally, I was going to answer your suggestion of using separate threads
with the boilerplate response that, "threads don't fix anything, and they
usually just complicate things".  However, I started thinking about the
problem, and it turns out that threads are pretty useful in this

The reason that xwinclip steals the XA_PRIMARY selection as soon as a client
(xterm) modifies that selection is that xwinclip needs to be the owner of
the XA_PRIMARY selection in order to receive notification when the selection
is updated.  If xwinclip doesn't receive notification of a selection update,
then xwinclip can't copy the new selection data to the Windows clipboard.
The end result would be that you would select data in an X client, but that
data would not be available in Windows.  Actually, the first time that you
select data in an X client it would be available in Windows (as xwinclip
would receive notification upon losing ownership of XA_PRIMARY), however,
subsequent modifications of XA_PRIMARY by either the same X client or
another X client would not cause xwinclip to be notified, thus preventing
the subsequent selections from being available in Windows.

I went ahead and rewrote xwinclip using threads.  Threads make xwinclip a
little less kludgy, but, unfortunately, they don't solve the problem
described above.  That is, we still need a way for xwinclip to be notified
when *any* X client modifies XA_PRIMARY, not just when xwinclip loses
ownership of XA_PRIMARY because an X client has modified it.  Only then will
xwinclip be able to stop stealing ownership of the XA_PRIMARY selection.

It is possible that a simple solution exists... but I haven't yet come
across it.  I'm sure Alan H. will email me immediately afterwards with a
suggestion :)

Hope that helps to explain the undesired behavior,


> -----Original Message-----
> From: Josh Baudhuin [mailto:joshb@cadence.com]
> Sent: Thursday, January 17, 2002 6:48 PM
> To: huntharo@msu.edu
> Subject: xwinclip comment
> Hi, Harold
>    Thanks for the xwinclip--I just came across it yesterday and am
> (mostly!) lovin' it. The sole complaint I have is that it seems to
> hijack the selection immediately after it's established in another X
> app. Thus, for example, if I select something in an XTerm, the highlight
> vanishes after I let go of the mouse button.
>    Is this something that requires integration w/ the X server app? Or
> is the problem that you need to avoid having two event loops (one for X
> and one for Windoze)? You might try putting them in separate threads, in
> case of the latter...
> --Josh

More information about the Cygwin-xfree mailing list