Skip to content

input/seatop_down: update touch drag focus while dragging#9182

Open
hjanuschka wants to merge 1 commit into
swaywm:masterfrom
hjanuschka:fix-touch-dnd
Open

input/seatop_down: update touch drag focus while dragging#9182
hjanuschka wants to merge 1 commit into
swaywm:masterfrom
hjanuschka:fix-touch-dnd

Conversation

@hjanuschka

@hjanuschka hjanuschka commented Jun 11, 2026

Copy link
Copy Markdown

Drag-and-drop started from a touchscreen (long-press drag) never works in sway: the drag icon follows the finger, but drop targets never receive wl_data_device.enter/motion, and on touch up the source gets cancelled instead of a drop.

Root cause: wlroots' touch drag grab only emits wl_data_device.enter from wlr_seat_touch_point_focus(), and drag_handle_touch_motion() only sends motion when the drag has a focused surface. Sway never calls wlr_seat_touch_point_focus() anywhere, so a touch drag never gets a focus. seatop_down's handle_touch_motion() also only forwards coordinates relative to the original surface and never re-picks what is under the finger.

Fix: while a touch drag is active for the moving touch point, re-pick the surface under the finger and update the touch point focus before notifying motion. This mirrors what pointer drags get implicitly from wlr_seat_pointer_notify_enter() on cursor motion.

Related: the library-side half of this was fixed in wlroots (wlroots/wlroots#3476, "Touch DnD fixes" MR), this is the missing compositor-side half. Mutter fixed the equivalent bug recently too (mutter MR 5057), and KWin already handles touch dnd.

Tested on a touchscreen with Chromium (trying to bring touch/drag to Linux: https://crbug.com/451651623)

The touch drag grab in wlroots only sends wl_data_device.enter from
wlr_seat_touch_point_focus() and only sends wl_data_device.motion when
the drag has a focused surface. Sway never called it, so touch-initiated
drags never delivered enter/motion to drop targets and the source was
cancelled instead of dropped on touch up.

While a touch drag is active for the moving touch point, re-pick the
surface under the finger and update the touch point focus before
notifying motion, mirroring what pointer drags get implicitly via
wlr_seat_pointer_notify_enter().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant