Skip to content

wayland: set a transient parent before the initial configure - #1

Open
kevinard wants to merge 1 commit into
canopa/basefrom
canopa/wayland-transient-parent
Open

kevinard wants to merge 1 commit into
canopa/basefrom
canopa/wayland-transient-parent

Conversation

@kevinard

Copy link
Copy Markdown
Owner

Canopa fork tracking PR. Its diff against canopa/base (upstream v0.30.13, e9809ef) is exactly the change Canopa carries. It is merged into canopa/main, which Canopa builds. This PR stays open until the change is upstreamed or dropped.

What

WindowAttributesExtWayland::with_transient_parent(Arc<Window>):

  • validates that the parent is a Wayland window on the same connection (otherwise window creation fails with an OsError);
  • calls xdg_toplevel.set_parent right after the SCTK window is created, before its first commit and initial configure;
  • keeps the parent alive until creation; the application owns both windows afterwards.

Why

Canopa Files opens a floating Quick Look attached to its Browser window. Setting the parent after creation is too late: on Niri the child floated but kept the initial tiled 1280 × 800 size instead of the requested 760 × 600, because the first configure had already been computed for a tiled toplevel. See Canopa ADR 0019. Iced's window::open_transient (kevinard/iced) builds on this.

Verification

  • cargo check --all-targets passes at this branch with the Wayland features Canopa uses (--no-default-features --features rwh_06,wayland,wayland-dlopen,wayland-csd-adwaita) and with the default features (X11 + Wayland).
  • In Canopa: Files native acceptance of Quick Look (dark/100 % and light/125 %) checks actual floating dimensions, not only floating status.

Upstream

Related: issue rust-windowing#4256 and PR rust-windowing#4627 (open) on transient parents. Still applies to upstream master. The hunks are not rustfmt-formatted yet; clean them before submission.

🤖 Generated with Claude Code

Window::set_parent support through the cross-platform parent attribute is
not implemented on Wayland, and setting xdg_toplevel.set_parent after
the window has been created is too late: the first commit has already
requested the initial configure, so a tiling compositor sizes the window
as a tiled toplevel even if it later floats it once the parent arrives.

Add WindowAttributesExtWayland::with_transient_parent(Arc<Window>). The
parent is validated (it must be a Wayland window on the same connection)
and applied with xdg_toplevel.set_parent right after the SCTK window is
created and before its first commit, so the compositor can choose the
size and placement of an auxiliary window from the start. The attribute
keeps the parent alive until creation; the application owns both windows
afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant