Subject: how to check if a window exists

From: Dominik Vogt <[email-masked]>
Date: Sat, 3 Apr 1999 02:39:26 +0200

There is a minor bug (#78) that occurs when a window
doesn't exist anymore when fvwm processes a button
press that went into that window (can happen with server
grabs). A way to work around this would be to check if
the window exists before handling the event. Any ideas
how to check if a window with a given id exists (without
generating a BadWindow)?

Bye

Dominik ^_^

--
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Brad Giaccio <[email-masked]>
Date: Tue, 6 Apr 1999 10:43:39 -0400

> how to check if a window with a given id exists (without

Dominik,
Well after some searching this is the best I could find was:

Status XQueryTree(display, w, root_return, parent_return,
     children_return, nchildren_return)
           Display *display;
           Window w;
           Window *root_return;
           Window *parent_return;
           Window **children_return;
           unsigned int *nchildren_return;

Now this call can can still throw a badWindow error if you pass it
a nonexistent window dispite what the man page says.  But what you
could do is pass the root window as the arg to w and then check the
children_return list for the window before you continue handling it.
The only problem here is that once you get the list back you need to do
a linear search to find it, and then you have to free the elements of
the list as well.

Well that is the best I could find, although it is pretty stupid of Xlib
to through and error but no give you any way to check for it first.

Brad
-- 
--- There are two kinds of knowledge, you either know the answer or
			you know where to find it
		      -Kane, Johnson, and anonymous
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]