Drag and Drop bug on Nautilus/Nemo under Wayland due to patch in Mutter
Several days ago I found that in Gnome Shell 3.34 it was not possible to drag files from other programs into Nautilus file manager when working under Wayland: the drag was not accepted. But under X11 it worked fine. And other programs (like Gedit) did accept files dragged into them in both X11 and Wayland. Also, the same Nautilus code did work fine with Gnome Shell 3.32 in both X11 and Wayland. Doing several tests I found that it also happened with Nemo file manager. Of course, this happens only when doing DnD between different processes; when dragging and dropping between windows of the same app (like when dragging a file from a nautilus window to another nautilus window, both in the same process) everything seems to work fine both in X11 and Wayland. But, for example, dragging a file from Nautilus to Nemo (or vice-versa) doesn't work under Wayland in Gnome Shell 3.34, but does work under X11.
After doing several tests, I discovered that the bug was in mutter: the same nautilus code, with the same Gtk library, worked fine in mutter 3.32.2 but failed in 3.34.0.
After bisecting the code, I found that the bug was inserted in the commit 634f512b :
Nov 22, 2018 15:56:24 CET
wayland: Integrate with MetaSelectionMake MetaWaylandDataDevice use MetaSelection and MetaSelectionSource to handle primary/clipboard/dnd.
I attach a little program (test_dnd.js) that allows to drag a fake file, to allow to test this. Just open a Nautilus window and my program, and drag the icon from my program into a Nautilus or Nemo window: in the old versions of mutter, Nautilus/Nemo will accept the drag (and show an error because the file itself doesn't exist; if you want it to not show the error, just create the file /a_drag_test.txt
), but in the current ones it silently fails by rejecting the drag.