Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7 Previous Document: 183) How can I most quickly send an image to the X server? Next Document: 185) Can I have two applications draw to the same window? See reader questions & answers on this topic! - Help others by sharing your knowledge My program has the ID of a window on a remote display. I want to check whether the window exists before doing anything with it. Because X is asynchronous, there isn't a guarantee that the window would still exist between the time that you got the ID and the time you sent an event to the window or otherwise manipulated it. What you should do is send the event without checking, but install an error handler to catch any BadWindow errors, which would indicate that the window no longer exists. This scheme will work except on the [rare] occasion that the original window has been destroyed and its ID reallocated to another window. You can use this scheme to make a function which checks the validity of a window; you can make this operation almost synchronous by calling XSync() after the request, although there is still no guarantee that the window will exist after the result (unless the sterver is grabbed). On the whole, catching the error rather than pre-checking is preferable. [courtesy Ken Lee (now kenton@esd.sgi.com), 4/90; 12/93] User Contributions:Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7 Previous Document: 183) How can I most quickly send an image to the X server? Next Document: 185) Can I have two applications draw to the same window? Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: faq%craft@uunet.uu.net (X FAQ maintenance address)
Last Update March 27 2014 @ 02:12 PM
|
Comment about this article, ask questions, or add new information about this topic: