xwinclip re selection polling

Chris Twiner c_twiner@hotmail.com
Wed Aug 28 13:53:00 GMT 2002


Hi All,

I posted last week that I had a possible solution to the xwinclip selection 
behaviour.  I didn't get any feedback so I endeavoured to do it anyway.  So 
this ones a bit long but it's an explanation of how I've got it working ..

Basic premise :

Use a seperate dll that runs a system wide Windoze hook to catch all 
activate messages.  2 events are of interest in the hook, when 
Cygwin/XFree86 is activated and when it is deactivated.  When an event is 
detected the hook then sends a broadcast registered message to all top level 
windows.

The top level Windoze window for xwinclip is run in a seperate thread and as 
such always receives the messages.  Upon receipt of the activation messages 
flags are set up that indicate that either xtowindows be called or 
windowstox.  These functions copy the data in the respective directions.

The flags have to be used so the main thread (the owner of pDisplay) is the 
one that calls the functions.  They in turn either XSetSelectionOwner 
(windowstox) or they XConvertSelection (xtowindows) to set the messages 
running.

Major changes are that the select in xwinclip.c has a time limit applied and 
that the XSetSelectionOwner in xevents.c and XSetSelectionOwner in 
xwinclip.c are removed.

This means that all selection operations behave as expected in XWin with 
xwinclip running.

However I have some limitations:

closing xwinclip:
   closing XWin closes xwinclip but doesn't go through WM_DESTROY on the x 
window, just
XIO:  fatal IO error 113 (Connection aborted) on X server "127.0.0.1:0.0"
      after 48 requests (47 known processed) with 0 events remaining.
   I made a script to close xwinclip via sending an X message but it results 
in crashing XWin as well.

the select statement timeout:
   In order to get the polling on the notification flags (from the windows 
thread) the timer is set to 1 sec (or some other time).  Is there a way to 
make the flags act as file descriptors for the select statement?

Any help on the problems would be appreciated.

The code is still (cough cough) a little rough n ready so I will release it 
when appropriate.  Is putting a zip attachment on this mailing list 
appropriate?

I have only been working on this for 3 days and it's my first attempt at X 
antics so if these are FAQ style items I appologise (I've looked just can't 
find them).

Regards,

Chris Twiner

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com



More information about the Cygwin-xfree mailing list