Skip to content

fix(wayland): fall back to offered action when dnd_finished arrives without action - #2639

Merged
Hona merged 1 commit into
devfrom
fix/wayland-drag-source-missing-action
Nov 27, 2026
Merged

Hona merged 1 commit into
devfrom
fix/wayland-drag-source-missing-action

Conversation

@Hona

@Hona Hona commented Nov 27, 2026

Copy link
Copy Markdown
Member

Addresses #526.

Root cause

On Wayland wl_data_source v3+, dnd_finished only fires after the drop destination accepted and finished the drop (wl_data_source.cancelled fires on cancellation). Compliant compositors emit wl_data_source.action before dnd_finished, setting DragSession::selected_action.

Hyprland <= v0.57.2 (fixed upstream on main in hyprwm/Hyprland#16808 after v0.57.2) emits dnd_finished without ever sending wl_data_source.action. Because selected_action remained SourceAction::None, Event::Finished resolved to DragOutcome::Cancelled on every completed drop.

Fix

  • Store the source's offered_actions bitmask on DragSession when a drag starts (crates/rune/src/platform/wayland/drag_source/machine.rs).
  • Replace SourceAction::to_outcome with SourceAction::finished_outcome(offered_actions) for Event::Finished:
    • Explicit SourceAction::Copy -> DragOutcome::Copied (unchanged)
    • Explicit SourceAction::Move -> DragOutcome::Moved (unchanged)
    • Missing action (SourceAction::None) on dnd_finished:
      • Copy offered (including Copy | Move) -> DragOutcome::Copied (safe non-destructive default; never falsely reports Moved on a Copy | Move drag)
      • Only Move offered -> DragOutcome::Moved
      • Neither offered -> DragOutcome::Cancelled
  • Explicit Event::Cancelled continues to report DragOutcome::Cancelled.

Verification

  • Ran cargo check -p rune --lib and cargo test -p rune --lib drag_source (14 passed, 0 failed) on Windows, including new unit and state-machine tests covering Hyprland's dnd_finished-without-action sequences (Copy, Copy | Move, Move-only, None, explicit Cancelled, and explicit Action(Move)).
  • Not tested on a live Linux Wayland / Hyprland desktop session in this environment.

@Hona
Hona merged commit 8bee715 into dev Nov 27, 2026
@Hona
Hona deleted the fix/wayland-drag-source-missing-action branch November 27, 2026 15:14
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