|
From: Daniel J S. <dan...@ie...> - 2006-07-18 06:47:01
|
I believe I have the selection features worked out for the X11 clipboard. As far as the race condition, I think I have it now so that rarely does selecting and clicking not work. Tell me if this logic and part of the solution makes sense. Here are the basic commands in handling that event (before the change I made): XChangeProperty(dpy, reply.xselection.requestor, reply.xselection.property, reply.xselection.target, 32, PropModeReplace, (unsigned char *) requested_pixmap, 1); XSendEvent(dpy, reply.xselection.requestor, False, 0L, &reply); XFlush(dpy); So the idea is to set some property and send an event to the requestor saying the information it requested is *ready to go*. (Emphasis for later... point is, no it isn't ready.) That is, XChangeProperty is changing some property on the *client* window. There is this Pixmap sitting in X land and it puts the location of the Pixmap atom on that Window. I think, however, that things don't necessarily happen contiguously in X that way. So, it could well be that the Property Change is not actually complete before the time the sent event reaches the window. The client on its end gets the message, goes to look for the property on its window and realizes it doesn't find the information gplt_x11 said was there, on occassion. SO, the idea is to force the requestor window to clear all pending updates before sending the event. Here's the additional command: XChangeProperty(dpy, reply.xselection.requestor, reply.xselection.property, reply.xselection.target, 32, PropModeReplace, (unsigned char *) requested_pixmap, 1); XClearWindow(dpy, reply.xselection.requestor); XSendEvent(dpy, reply.xselection.requestor, False, 0L, &reply); XFlush(dpy); Note that this ClearWindow goes to the requestor. We're basically then waiting for the information we sent to the requestor window to get there before we send the event. Dan |