Skip to content

Support xdg-foreign-unstable-v2 protocol#4867

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/support-xdg-foreign
Draft

Support xdg-foreign-unstable-v2 protocol#4867
Copilot wants to merge 2 commits intomainfrom
copilot/support-xdg-foreign

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

GTK apps (e.g. Purple Task) warn "Server is missing xdg_foreign support" because Mir lacks zxdg_exporter_v2/zxdg_importer_v2. This breaks cross-process surface parent-child relationships, making buttons like "View source code" and "Report issues" in sandboxed Flutter apps non-functional.

What's new?

  • wayland-protocols/xdg-foreign-unstable-v2.xml — protocol definition for zxdg_exporter_v2, zxdg_importer_v2, zxdg_exported_v2, zxdg_imported_v2
  • src/server/frontend_wayland/xdg_foreign_unstable_v2.{h,cpp} — implementation:
    • XdgForeignV2Registry: shared registry mapping opaque handle strings to exported WlSurface weak refs, with per-handle importer tracking for destroyed event delivery
    • Export path: ZxdgExportedV2 generates a random 128-bit hex handle, sends it via the handle event
    • Import path: ZxdgImportedV2::set_parent_of() resolves the handle to a scene surface and sets it as the parent via WlSurface::update_surface_spec(); defers via on_scene_surface_created if the exported surface has no scene surface yet
    • Destruction: ZxdgExportedV2 destruction (explicit or surface-driven) drains the importer list and sends destroyed to each
  • wayland_default_configuration.cpp — registers the combined exporter+importer global under mw::XdgExporterV2::interface_name; both Wayland globals are created in one call
  • zxdg_exporter_v2 added to get_standard_extensions() — enabled by default
  • src/wayland/symbols.map — exports all four new wrapper classes under MIRWAYLAND_2.17

How to test

Run a GTK4 application (e.g. any app using GtkFileChooserNative or GtkPrintDialog) under a Mir-based compositor and verify the "Server is missing xdg_foreign support" warning no longer appears. Cross-process dialogs (portals) should now correctly set the parent window relationship.

Checklist

  • Tests added and pass
  • Adequate documentation added
  • (optional) Added Screenshots or videos

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https --local /home/REDACTED/.ca/var/lib/dpkg/reassemble.deb tar -x _amd64.deb - /usr/bin/dpkg-deb 2.1ubuntu3.2_amdrm d64.deb /usr/local/sbin/-- (dns block)
  • gitlab.freedesktop.org
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Apr 20, 2026 that may be closed by this pull request
Implements the zxdg_exporter_v2 and zxdg_importer_v2 Wayland protocols
which allow cross-client surface parent-child relationships. This fixes
GTK apps warning 'Server is missing xdg_foreign support'.

Agent-Logs-Url: https://github.com/canonical/mir/sessions/f077889f-0f3f-4fdc-ab26-c1ae4d2eb835

Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
Copilot AI changed the title [WIP] Support xdg foreign in Purple Task app Support xdg-foreign-unstable-v2 protocol Apr 20, 2026
Copilot AI requested a review from AlanGriffiths April 20, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support XDG foreign

2 participants