how to get a notification about foreign window destruction?



 Hello,

 I need to create a window with a couple of widgets in it inside an
existing window in another application which invokes my program by passing
it the XID of this existing window. So I use gdk_window_foreign_new() to
create a GdkWindow for it and then create a GtkWindow which I reparent
under this GdkWindow using gdk_window_reparent() and finally create the
other widgets inside this GtkWindow as usual.

 So far so good. However the problems happen if the foreign window is
destroyed because then all the GTK windows are destroyed too and as GTK
didn't ask it for it to happen it gets upset and complains about the
"unexpectedly destroyed" GdkWindows (from gdk_window_destroy_notify() in my
GTK+ version which is 2.8.20 from Debian Etch). And at the same time the
various GtkWidgets I created are not destroyed and, worse, if I do destroy
them, I get X BadWindow errors as all GdkWindows of these widgets don't
exist any more.

 Does anybody have any idea about how to deal with it? I thought about
using gdk_window_add_filter() and reacting to DestroyNotify event myself
but I don't really see what can I do (short of ignoring them completely
which would probably take care of the warnings but not of the memory
leaks). From reading GDK sources it seems calling _gdk_window_destroy()
with TRUE second argument would be the right thing to do -- but I can't do
this as this function is private. Is there any other way to make this work
or maybe a completely different and simpler/better approach?

 Thanks in advance for any ideas,
VZ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]