Skip to content

Add window::open_transient for parented auxiliary windows - #3

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

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

Conversation

@kevinard

Copy link
Copy Markdown
Owner

Canopa fork tracking PR. Its diff against canopa/base (595af03, the tip of upstream's 0.14 branch when iced_widget 0.14.2 was released. iced_winit and iced_runtime there are identical to the 0.14.0 release, 3997291) is exactly the change Canopa carries in iced_winit/iced_runtime. It is merged into canopa/main, which Canopa builds. This PR stays open until the change is upstreamed or dropped.

What

  • iced_runtime: window::open_transient(parent, settings) -> (Id, Task<Option<Id>>) and Action::OpenTransient.
  • iced_winit: Control::CreateWindow carries the parent's native window, and transient::attributes applies it with winit's Wayland with_transient_parent before the first commit. The task yields Some(id) when the window opens. It yields None when the parent is gone or the backend cannot parent windows (anything other than Wayland), and then no window is shown.
  • The open channel becomes OpenResponse (Normal / Transient).

winit pin: the root Cargo.toml adds [patch.crates-io] winit = { git = "https://github.com/kevinard/winit", rev = "99f9e76c37b5…" }, pointing at kevinard/winit canopa/wayland-transient-parent (set a transient parent before the initial configure). Cargo.lock is updated to match. canopa/main pins winit's canopa/main instead.

Why

Canopa Files opens a floating Quick Look attached to its Browser window, at the requested size. The parent must be known before the first configure, or tiling compositors keep the tiled size. See Canopa ADR 0019.

Verification

  • cargo check --locked --all-targets -p iced_winit -p iced_runtime -p iced_test (default features) and cargo check --locked -p iced --no-default-features --features advanced,wgpu,crisp,web-colors,thread-pool,wayland,image (Canopa's selection) pass at this branch. The only warning is the pre-existing f32::INFINITY deprecation in iced_widget.
  • cargo test --locked -p iced_winit -p iced_runtime --lib passes.
  • In Canopa: Files Quick Look native acceptance (dark/100 % and light/125 %) checks the floating window's actual dimensions.

Upstream

Upstream it. iced master still uses winit 0.30.13, and winit has no Wayland parent yet: issue rust-windowing/winit#4256 and PR rust-windowing/winit#4627 are open. The [patch.crates-io] pin is fork-only and goes away once winit provides the API.

🤖 Generated with Claude Code

There is no way to open a window attached to an existing one (for
example a floating preview or a non-modal dialog). Setting the parent
after creation is too late on Wayland: a tiling compositor sizes the
window from its first configure, before the parent is known.

Add `window::open_transient(parent, settings)` and
`Action::OpenTransient`. The `winit` shell passes the parent's native
window through `Control::CreateWindow` and sets it with winit's Wayland
`with_transient_parent` attribute before the first commit. The task
resolves to `Some(id)` once the window is open, or `None` when the
parent is gone or the backend cannot parent windows (currently anything
but Wayland), in which case no window is shown. To report this, the
open channel becomes an `OpenResponse` carrying either kind of sender.

Requires winit's `WindowAttributesExtWayland::with_transient_parent`;
`Cargo.toml` patches winit to the fork commit that provides it.

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