You are right, this is on GTK3. Hopefully, once GTK4 becomes predominant, it might not be useful to have foreign windows. But TBD!
> if ((window != NULL) && (msg->hwnd != GetDesktopWindow ()))
> gdk_window_destroy_notify (window);
This line actually destroys the window, so GDK_WINDOW_DESTROYED becomes true at that point. This is due to:
> static void gdk_win32_window_destroy_notify (GdkWindow *window)
where
> if (!GDK_WINDOW_DESTROYED (window)),
it
> _gdk_window_destroy (window, TRUE);
So the line after, once the window is actually destroyed, it breaks
> if (window == NULL || GDK_WINDOW_DESTROYED (window))
> break;
and never enters the following lines.
> event = gdk_event_new (GDK_DESTROY);
> event->any.window = window;
>
> _gdk_win32_append_event (event);