On Wayland the compositor can be informed about the semantic relationships between the windows via the xdg_foreign protocol.