This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xwinclip re selection polling


I think the goal in the not-too-far-away-future is to have xwinclip integrated directly inside the XWin app. This would save you the trouble to use SetWindowsHookEx, which IIRC is a big piece of crap. Also, this would save you the trouble of killing xwinclip while XWin is still running.

Jehan

Chris Twiner wrote:
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





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]