SUMMARY The documentation for the wl_data_source.action event says the following: > It is only possible to receive this event after > wl_data_source.dnd_drop_performed if the drag-and-drop operation ended > in an "ask" action, in which case the final wl_data_source.action event > will happen immediately before wl_data_source.dnd_finished. KWin 6.5.2 sends wl_data_source.action(0) soon after wl_data_source.dnd_drop_performed(). This seems to violate the specification, since the DnD operation didn't end in an "ask" action (value 4). Previous set_actions() only sets the allowed actions to (copy | move == value 3). This doesn't seem to be reproducible on KWin 6.4.5 (Kubuntu 25.10). STEPS TO REPRODUCE 1. Run kwrite (or any other application) with WAYLAND_DEBUG=1 2. Insert some text into the editor 3. Select a portion of the text, and drag it to a different position in the document OBSERVED RESULT The text is dragged as expected. The Wayland debug log shows the following: > [1126301.964] {Default Queue} -> wl_data_device_manager#12.create_data_source(new id wl_data_source#55) > [1126301.967] {Default Queue} -> wl_data_source#55.offer("text/plain") > [1126301.970] {Default Queue} -> wl_data_source#55.offer("text/plain;charset=utf-8") > [1126301.972] {Default Queue} -> wl_data_source#55.set_actions(3) > [1126301.977] {Default Queue} -> wl_data_device#13.start_drag(wl_data_source#55, wl_surface#46, wl_surface#69, 18832) > ... > [1126830.810] {Default Queue} wl_data_device#13.drop() > ... > [1126831.586] {Default Queue} -> wl_data_source#55.destroy() > [1126831.593] {Default Queue} discarded wl_data_source#55.dnd_drop_performed() > [1126831.595] {Default Queue} wl_data_device#13.leave() > [1126831.601] {Default Queue} discarded wl_data_source#55.action(0) The events are discarded by this specific client, but they are sent. Other client applications might not discard these events and behave incorrectly. EXPECTED RESULT The text is dragged as expected. The Wayland debug log doesn't show anything strange. SOFTWARE/OS VERSIONS Operating System: Fedora Linux 43 KDE Plasma Version: 6.5.2 KDE Frameworks Version: 6.19.0 Qt Version: 6.10.0 Kernel Version: 6.17.7-300.fc43.x86_64 (64-bit) Graphics Platform: Wayland ADDITIONAL INFORMATION Leads to https://youtrack.jetbrains.com/issue/JBR-9591/Wayland-Drag-Drop-of-highlighted-text-in-the-editor-causes-duplication#focus=Comments-27-12964973.0-0. The workaround for clients is to ignore wl_data_source.action(0) requests after wl_data_source.dnd_drop_performed()
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/8538
Git commit 41d338b7320357c35d2d24f01272f2193563e3a2 by Vlad Zahorodnii. Committed on 09/12/2025 at 18:35. Pushed by vladz into branch 'master'. wayland: Fix sending wl_data_source::dnd_action(0) after drop updateDragTarget() can be called after performing a drop to clean up the drop handler. If that happens, don't send the dnd action. M +9 -0 autotests/integration/dnd_test.cpp M +9 -6 src/wayland/datadevice.cpp https://invent.kde.org/plasma/kwin/-/commit/41d338b7320357c35d2d24f01272f2193563e3a2
Git commit d85090db362328bb4884fdbdb7de047f20960e1c by Vlad Zahorodnii. Committed on 09/12/2025 at 19:00. Pushed by vladz into branch 'Plasma/6.5'. wayland: Fix sending wl_data_source::dnd_action(0) after drop updateDragTarget() can be called after performing a drop to clean up the drop handler. If that happens, don't send the dnd action. (cherry picked from commit 41d338b7320357c35d2d24f01272f2193563e3a2) M +9 -0 autotests/integration/dnd_test.cpp M +9 -6 src/wayland/datadevice.cpp https://invent.kde.org/plasma/kwin/-/commit/d85090db362328bb4884fdbdb7de047f20960e1c