auto target = Gtk::DropTarget::create(ustring_type, Gdk::DragAction::COPY);
to
auto target = Gtk::DropTarget::create(GDK_TYPE_FILE_LIST, Gdk::DragAction::COPY);
I could drag files from nautilus. Result:
Received unexpected data type "GdkFileList" in button
which is expected. I didn’t make any change in DnDWindow::on_button_drop_drop_data().
I don’t know why you get warnings and a critical message. Which versions of
gtk and gtkmm do you use? I used gtk 4.7.1 and the latest gtkmm in the git repository.
I tested with gtk 4.6.1 and gtkmm 4.6.1. It works just like 4.7.1.
It also works with the original version of dndwindow.cc. Then DnDWindow::on_button_drop_drop_data()
receives the names of the dragged and dropped files.
What you’ve seen might be a bug that shows up only with the X11 backend.
This is partly true. I also checked on kde wayland there are also errors BUT the callback is still called with the correct data. I don’t think this is a bug related to GTK4 because on xfce4 which works with X11 everything works (although some error also appears). It’s also worth noting that I’m using kde 5.24, maybe in 5.25 this problem has already been solved.