Skip to content

Add native drag and drop handles to window - #6

Open
kevinard wants to merge 1 commit into
canopa/basefrom
canopa/drag-drop
Open

kevinard wants to merge 1 commit into
canopa/basefrom
canopa/drag-drop

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::drag_drop: renderer-neutral DragDrop, Offer and Source handles with retained snapshots and coalesced notices, an opaque Origin capability for the pressed left button, bounded byte I/O, and drag_drop::enable(id) / Action::EnableDragDrop to opt a window in.
  • iced_winit::drag_drop: an adapter onto winit's Wayland data-device endpoint. Other backends return None, and no data device exists until a window opts in.

winit pin: the root Cargo.toml adds [patch.crates-io] winit = { git = "https://github.com/kevinard/winit", rev = "eeaff073f326…" }, pointing at kevinard/winit canopa/wayland-drag-drop (data-device drag and drop). Cargo.lock is updated to match. canopa/main pins winit's canopa/main instead.

Why

Canopa Files needs outgoing file-URI drags, incoming offers, Copy/Move negotiation and asynchronous completion, with no file-manager policy in the shared toolkit. See Canopa ADR 0023 (and Files ADR 0094).

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 drag and drop runs on this adapter. Scoped native acceptance is in progress (ADR 0023).

Upstream

Keep this locally until an upstream API is agreed. winit 0.31 has its own data-transfer API (rust-windowing/winit#4571), and this adapter should move to it when iced moves to 0.31.

🤖 Generated with Claude Code

Applications such as file managers need outgoing file drags, incoming
offers with their MIME types, Copy/Move negotiation and asynchronous
completion. The existing file-drop window events expose none of that.

Add `runtime::window::drag_drop`: renderer-neutral `DragDrop`, offer and
source handles with retained snapshots and coalesced change streams, an
opaque origin capability for the pressed left button, bounded byte I/O
futures, and `drag_drop::enable(id)` (`Action::EnableDragDrop`) to opt a
window in. The `winit`
shell implements them on top of winit's Wayland data-device endpoint;
other backends return `None`. No data device is created until a window
asks for one.

Requires winit's `WindowExtWayland::drag_drop`; `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