Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » GTK+
  • » how to get a notification about foreign window destruction? [RSS Feed]

#1 March 11, 2008 14:27:23

Vadim Z.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

how to get a notification about foreign window destruction?


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,

gtk-list mailing list


  • Root
  • » GTK+
  • » how to get a notification about foreign window destruction? [RSS Feed]

Board footer

Moderator control

Enjoy the 19th of March

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support