Repository navigation
Description
Is your feature request related to a problem? Please describe.
Dialog matching relies on a client-declared parent as its strongest signal (matching algorithm, Dialog / Child Window → signal 1: client parent via xdg_toplevel.set_parent / X11 transient). But an out-of-process dialog cannot set that parent directly. Sandboxed or separate-process dialogs — a Flatpak app's native file chooser, a portal dialog rendered by another process — reference the owning window through the xdg-foreign protocol instead: the requester exports its toplevel, the dialog's process imports the handle, and it calls zxdg_imported.set_parent_of. That relation is never declared to us today, so the matching engine is left guessing with weaker signals (activatedBy, process sibling, fixed size) exactly where an authoritative one exists.
Describe the solution you'd like
Implement the xdg-foreign importer (v1 and v2) alongside the exporter we already have, and record zxdg_imported.set_parent_of as MetaWindow.parent (emitting parent_changed), so the client-declared surface-to-surface relation feeds dialog routing exactly like xdg_toplevel.set_parent.
This would give dialog matching an authoritative owner for cross-process/sandboxed dialogs (the Dialog / Child Window → signal 1 path) instead of routing them heuristically.
Describe alternatives you've considered
- Keep relying on
activatedBy/ process-sibling heuristics for cross-process dialogs (current behaviour). Works for some toolkits but is not authoritative and can misroute. - Reuse smithay's bundled
wayland::xdg_foreignmodule. Its handle→surface registry is private with no accessor, so it can serve the protocol but cannot be queried — which is why the exporter we added is in-house. The importer would need to be in-house too unless upstream exposes the registry.
Additional context
- The exporter (v1 + v2) already lands in
src/embedder/wayland/xdg_foreign.rs; it is used to resolve the portalparent_windowfor the file chooser. The importer is the natural other half of the same module. - The protocol specifies
set_parent_ofwith "the same stacking and positioning semantics asxdg_toplevel.set_parent" (wayland.app, xdg-foreign-unstable-v2), so it maps cleanly onto the existingparentsignal andXdgShellHandler::parent_changedmachinery; no new matching signal is needed, just a new source for the one that already ranks first. - Client behaviour: Chromium only exports (v1); GTK binds both and uses import for
set_transient_for_exported. So the importer's value is the matching signal, not the file chooser. - Spec references:
docs/specifications/matching_algorithm.md(Dialog / Child Window, Dialog routing, and theParentsignal under Client / protocol signals).
Activity
fix(window): dispose a matcher-created tile when its window is re-routed
fix(window): drop a re-homed window from the previous tile's display (#…