Wed Jan 23 06:27:00 GMT 2002
I think it goes without saying that the primary goal is to avoid all polling
solutions until any other feasible solution has been ruled out. We're still
in the stages of ruling out other possibilities.
> -----Original Message-----
> From: Brian Genisio [mailto:email@example.com]
> Sent: Wednesday, January 23, 2002 7:34 AM
> To: Harold Hunt; Josh Baudhuin
> Cc: cygx
> Subject: RE: xwinclip comment
> Well, I havent seen the code in a while, but I assume that you you use a
> standard X event loop...
> Might you, instead, change this from event driven to polling?
> if(new_property != known_property)
> This way, you dont need to register for events on the property.
> You could sleep for 250 ms for instance, which, in worst case, is
> probably long
> enough. (warning : usleep() is not thread safe, so you could probably use
> signals to handle a timeout). OR, you could throw this into xt,
> and use the
> timout capability, but that seems like too much for too little.
> Also, dont
> forget to use semaphores when copying (and reading from the
> windows thread) the
> I hope this helps in the brainstorming process, at least,
> --- Harold Hunt <firstname.lastname@example.org> wrote:
> > Josh,
> > 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
> > circumstance.
> > 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
> > 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
> > 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,
> > Harold
> > > -----Original Message-----
> > > From: Josh Baudhuin [mailto:email@example.com]
> > > Sent: Thursday, January 17, 2002 6:48 PM
> > > To: firstname.lastname@example.org
> > > 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
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
More information about the Cygwin-xfree