Skip to content

dnd: fix drag-and-drop onto panel applets - #675

Open
dahankzter wants to merge 3 commits into
pop-os:masterfrom
dahankzter:fix/dnd-forward-accept-to-host
Open

dnd: fix drag-and-drop onto panel applets#675
dahankzter wants to merge 3 commits into
pop-os:masterfrom
dahankzter:fix/dnd-forward-accept-to-host

Conversation

@dahankzter

@dahankzter dahankzter commented Aug 28, 2026

Copy link
Copy Markdown
  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

Blocked on Smithay/smithay#2146 — this cannot land until that merges and the smithay rev here is bumped.

Dropping a file onto a panel applet has never worked. Applets get enter and motion fine, then the drag ends in leave and wl_data_device.drop never arrives, which is why this looks like it should already work from reading the code.

Two separate causes, established from a WAYLAND_DEBUG capture on the panel:

  1. action_choice returned preferred verbatim whenever no seat had a local dnd_source — every drag that didn't start inside the panel. A client may leave preferred empty and libcosmic does, so the action negotiated to "none" and cosmic-comp refused the drop. Now uses smithay's default_action_chooser.

  2. Nothing relayed the applet's wl_data_offer.accept up to cosmic-comp. The host only sends drop once we've accepted on its offer. Source had no hook to observe that, hence the smithay PR.

The first two commits are independent and fine on their own. Only the third needs the new hook.

Tested on COSMIC 1.7.0, with a local [patch] pointing at a smithay fork (not part of this branch). Dropping onto the applet icon and onto a popup row opened mid-drag both deliver the path. On the wire: drop() from cosmic-comp, forwarded to the applet, receive("text/uri-list", fd) + finish() coming back.

Commits carry Co-Authored-By: Claude Opus 5 — this was written with Claude Code, with the diagnosis driven by wire captures rather than guesswork.

dahankzter and others added 3 commits August 28, 2026 15:55
Fires on every metadata() call.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCQQAWhxyYJwT49Zvcko6z
action_choice returned `preferred` verbatim whenever no seat had a local
dnd_source - that is, on every drag that didn't start inside the panel.
A client may leave preferred empty, and libcosmic does, so the action
negotiated to "none" and the host compositor refused the drop.

Use smithay's default_action_chooser.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCQQAWhxyYJwT49Zvcko6z
The host only sends drop once we have accepted on its offer, and we
never did, so every drop onto a panel applet was discarded - the drag
ended in leave instead. Applets were receiving enter/motion fine, which
is why this looked like it should already work.

Needs Source::accepted from Smithay/smithay#2146. Won't build until that
lands and the smithay rev here is bumped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DCQQAWhxyYJwT49Zvcko6z

@jacobgkau jacobgkau 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.

The PR template that you removed from the description is mandatory. Please add it back and fill it in.

@dahankzter

Copy link
Copy Markdown
Author

Sorry about that @jacobgkau it's back now

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