Skip to content

waylandbridge: emit drag-and-drop drop before pointer release - #90

Merged
superturtlee merged 1 commit into
SuperTurtleDev:mainfrom
Leeestephen:fix/dnd-drop-before-release
Sep 28, 2026
Merged

superturtlee merged 1 commit into
SuperTurtleDev:mainfrom
Leeestephen:fix/dnd-drop-before-release

Conversation

@Leeestephen

Copy link
Copy Markdown
Collaborator

Summary

Emit the compositor-owned drag-and-drop completion before forwarding the physical
pointer-button release.

Firefox can interpret wl_pointer.button(released) as cancellation when it arrives
before wl_data_device.drop(). This results in pointerup/dragend without a DOM
drop, leaving the Wayland data offer unfinished.

Change

tr_ptr_button() now calls awl_datadev_drag_end() before forwarding the tracked
pointer release.

The paired release is still forwarded afterward because Chromium requires a balanced
pointer press/release sequence.

The resulting order is:

wl_data_device.drop()
wl_data_source.dnd_drop_performed()
wl_data_device.leave()
wl_pointer.button(..., released)
wl_data_offer.finish()
wl_data_source.dnd_finished()

Untracked releases remain consumed as before.

Testing

Tested with LibreWolf running as a native Wayland client:

  • Before the change, drag-and-drop was intermittent.
  • Failed attempts produced pointerup/dragend without drop.
  • After the change, six consecutive controlled drags completed successfully.
  • All six delivered the expected DOM drop payload.
  • Each completed the Wayland offer lifecycle through wl_data_offer.finish() and
    wl_data_source.dnd_finished().

The change was also rebuilt successfully against the current upstream main.

Environment

  • Anland 6.2
  • Debian 13 arm64 under Droidspaces
  • Xiaomi Poco F3 / Snapdragon 870
  • LibreWolf 156.0-1, native Wayland
  • Physical BTN_LEFT-capable mouse exposed through Android input

Scope

This PR only changes DnD event ordering. A separate frame-callback lifecycle race
discovered during testing is handled independently in fix/frame-callback-dispatch-gc.

End the compositor-owned drag before forwarding the tracked button release. Firefox treats an earlier wl_pointer release as cancellation and never completes the data offer, while Chromium still receives the paired release immediately after the drop.
@superturtlee
superturtlee merged commit 8b8cf91 into SuperTurtleDev:main Sep 28, 2026
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