Skip to content

input/dnd: add Source::accepted so proxying sources can relay the target's choice - #2146

Merged
Drakulix merged 1 commit into
Smithay:masterfrom
dahankzter:dnd-accept-hook
Sep 3, 2026
Merged

input/dnd: add Source::accepted so proxying sources can relay the target's choice#2146
Drakulix merged 1 commit into
Smithay:masterfrom
dahankzter:dnd-accept-hook

Conversation

@dahankzter

@dahankzter dahankzter commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Source has hooks for the other two target->source requests — send for receive, choose_action for set_actions — but nothing for accept. handle_dnd sets data.accepted and that's the end of it.

That breaks proxying sources. A nested compositor forwarding a drag to its own clients implements Source, and the host compositor only sends drop once that nested compositor has accepted on the upstream offer. It currently has no way to know when to do that, so the drop never arrives and the drag just ends in leave.

This adds Source::accepted(Option<String>), called from the Accept arm. Default no-op, so nothing existing changes.

Found while fixing drag-and-drop onto cosmic-panel applets, which is broken for exactly this reason: pop-os/cosmic-panel#675, which uses this hook and is tested working against it.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DCQQAWhxyYJwT49Zvcko6z

…get's choice

Source has hooks for the other two target->source requests - send for
receive, choose_action for set_actions - but nothing for accept, so a
proxying source cannot relay it anywhere.

Nested compositors need it. When one forwards a drag to its own clients
it acts as the Source, and the host compositor only sends drop once the
nested compositor has itself accepted on the upstream offer. Without a
signal that a nested client accepted, it never can, and the drop is
silently discarded.

Default no-op, so existing implementations are unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCQQAWhxyYJwT49Zvcko6z
@dahankzter dahankzter changed the title dnd: let sources observe the target's accept input/dnd: add Source::accepted so proxying sources can relay the target's choice Aug 28, 2026

@Drakulix Drakulix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I don't see any issues with this approach. :)

@Drakulix
Drakulix merged commit 8090047 into Smithay:master Sep 3, 2026
13 of 14 checks passed
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.

2 participants