+// TODO: we probably need equivalent code for other GDK platforms
+#ifdef GDK_WINDOWING_X11
+
+extern "C" GdkFilterReturn
+wxNativeContainerWindowFilter(GdkXEvent *gdkxevent,
+ GdkEvent *event,
+ gpointer data)
+{
+ XEvent * const xevent = static_cast<XEvent *>(gdkxevent);
+ if ( xevent->type == DestroyNotify )
+ {
+ // we won't need it any more
+ gdk_window_remove_filter(event->any.window,
+ wxNativeContainerWindowFilter, data);
+
+ // the underlying window got destroyed, notify the C++ object
+ static_cast<wxNativeContainerWindow *>(data)->OnNativeDestroyed();
+ }
+
+ return GDK_FILTER_CONTINUE;
+}
+
+#endif // GDK_WINDOWING_X11
+