Peter Ware <ware(a)cis.ohio-state.edu> writes:
Hi Pete,
Gunnar Evermann
<Gunnar.Evermann(a)nats.informatik.uni-hamburg.de> writes:
> 1) call XQueryPointer to find out over which Window (if any) the
> pointer currently is. ('child_window')
The race condition is here. There is _no_ general purpose way you can
avoid it in an application -- potentially any other application can
delete the window between the time you do the query pointer and then
ask for the translate coordinates.
What do you mean "other application"?
I certainly hope that no other app kills my windows, or is that really
possible?
> 2) call XTranslateCoordinates() with this Window as the
destination
> window. 'If the coordinates are contained in a mapped child of
> dest_w, that child is returned to child_window.' (quote from man
> page)
To get around the problem, you (mentally) acknowledge that there is
no
way you can avoid the problem in your application. Instead you
OK, I can do that.
install an error handler that says -- "Oh, a bad window error,
I'll
ignore that". Do the translate coordinates, uninstall the error
handler, and check if the error handler indicated an error. I'd be
surprised if XEmacs didn't have something to do this automatically.
Oh, it does!
That would be expect_x_error() and x_error_occurred_p() in
device-x.c. The only drawback is that they call XSync(), which started
this whole thread :-(
Maybe we should just accept this damned X-errors... ;-(
Gunnar
--
Gunnar Evermann
Natural Language Systems Group, University of Hamburg
EMail: Gunnar.Evermann(a)nats.informatik.uni-hamburg.de