|
From: Dave D. <dde...@es...> - 2006-04-10 15:47:46
|
Daniel J Sebald <dan...@ie...> writes:
>>> If it did and gplt_x11.c attempts to also set ButtonPressMask, the
>>> window will crash.
>> Seems unlikely.
>> Shouldn't you just get an error return from the call to XSelectInput?
>
> No, I'm fairly certain I tried this. I wouldn't have added this "b"
> option if all that would happen is some kind of benign error value.
> The system does something bad, from what I remember. (I can
> probably force it with an internal code change just to test out.)
> From what I remember, when two clients want the ButtonPress the plot
> would appear and then clicking in the window would cause the window
> to go away.
>
Beware that the x protocol (and so xlib) is mostly
asynchronous. Errors are usually sent asynchronously, like events.
It is possible to handle errors, just a little messy. I forget the
details, but you can use XSync() to force a round-trip to the
server. This way, you can guarantee that all errors have been
delivered for requests up to the sync.
man XSync
...
The XSync function flushes the output buffer and then waits
until all requests have been received and processed by the X
server. Any errors generated must be handled by the error
handler. For each protocol error received by Xlib, XSync
calls the client application's error handling routine (see
section 11.8.2). Any events generated by the server are
enqueued into the library's event queue.
There there is some way in xlib to attach a hook for errors. You can
check to see if it is an error you expected, and you can tolerate.
ah - yes - see XSetErrorHandler
The default error handler just exits the client.
dd
--
Dave Denholm <dde...@es...> http://www.esmertec.com
|