STEPS TO REPRODUCE 1. drag a jpg file from Dolphin and try to drop it on Firefox running on Xwayland 2. 3. OBSERVED RESULT Firefox does not open the jpg file EXPECTED RESULT Firefox opens the jpg file SOFTWARE/OS VERSIONS Operating System: KDE neon Unstable Edition KDE Plasma Version: 5.22.80 KDE Frameworks Version: 5.83.0 Qt Version: 5.15.2 Graphics Platform: Wayland ADDITIONAL INFORMATION also reproducible with Opera internet browser
Can reproduce.
Spend some time investigating XVisit::drop never happens
And that's because kwin never considers the drag as accepted
Created attachment 138638 [details] kwin master crash on D&D onto Thunderbird attachment Dragged .pdf document from Files to XWayland Thunderbird, kwin commit 22f2e3e43c47433ac4eb185a2cd864625d5116d9 (HEAD -> master, origin/master, origin/HEAD)
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1020
Created attachment 138655 [details] kwin crash under valgrind Could reproduce the crash with following command for Valgrind: dbus-run-session valgrind --log-file=kwinxwayland.log kwin_wayland --exit-with-session=konsole --xwayland Then, run thunderbird and nautilus from opened konsole in nested session, then try d&d a .pdf file
Git commit 8a699ef1877e28927fc7227742d254deed69d9e9 by David Edmundson. Committed on 24/05/2021 at 14:06. Pushed by davidedmundson into branch 'master'. [xwl] Notify wayland that our data offer is accepted kwayland-server was updated to follow the result of whether the data offer was accepted before calling drop. Our bridge was not updated. We don't have enough data to know which mimeType the XWayland client actually has accepted, as that doesn't exist at an X11 level, but it doesn't have a big actual impact. Despite which mime type gets accepted any mimetype can be retrieved in the drop event. Tested against "dropsite" from QtBase widget examples forced into xcb mode using dolphin as a source. M +4 -0 src/xwl/drag_wl.cpp https://invent.kde.org/plasma/kwin/commit/8a699ef1877e28927fc7227742d254deed69d9e9
Git commit 297d88b10b5359796a0ee260e9484876bd42faa3 by David Edmundson. Committed on 24/05/2021 at 14:08. Pushed by davidedmundson into branch 'Plasma/5.22'. [xwl] Notify wayland that our data offer is accepted kwayland-server was updated to follow the result of whether the data offer was accepted before calling drop. Our bridge was not updated. We don't have enough data to know which mimeType the XWayland client actually has accepted, as that doesn't exist at an X11 level, but it doesn't have a big actual impact. Despite which mime type gets accepted any mimetype can be retrieved in the drop event. Tested against "dropsite" from QtBase widget examples forced into xcb mode using dolphin as a source. (cherry picked from commit 8a699ef1877e28927fc7227742d254deed69d9e9) M +4 -0 src/xwl/drag_wl.cpp https://invent.kde.org/plasma/kwin/commit/297d88b10b5359796a0ee260e9484876bd42faa3
There's a bit more left to fix, reopening
Second bug is, we stop XVisit when wayland says the drag ends, which in theory is after the drop event gets sent to the client. #0 KWin::Xwl::Xvisit::doFinish() (this=0x55555625f6e0) at /home/david/projects/kde5/src/kde/workspace/kwin/src/xwl/drag_wl.cpp:444 #1 0x000055555559197e in KWin::Xwl::Xvisit::leave() (this=0x55555625f6e0) at /home/david/projects/kde5/src/kde/workspace/kwin/src/xwl/drag_wl.cpp:265 #2 0x0000555555591b9e in KWin::Xwl::WlToXDrag::end() (this=0x5555560d53a0) at /home/david/projects/kde5/src/kde/workspace/kwin/src/xwl/drag_wl.cpp:91 #3 0x000055555558e53a in KWin::Xwl::Dnd::endDrag() (this=0x555555f28760) at /home/david/projects/kde5/src/kde/workspace/kwin/src/xwl/dnd.cpp:203 #4 0x000055555558fd01 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::Xwl::Dnd::*)()>::call(void (KWin::Xwl::Dnd::*)(), KWin::Xwl::Dnd*, void**) (f=(void (KWin::Xwl::Dnd::*)(KWin::Xwl::Dnd * const)) 0x55555558e4e0 <KWin::Xwl::Dnd::endDrag()>, o=0x555555f28760, arg=0x7fffffffc0c0) at /opt/qt5/include/QtCore/qobjectdefs_impl.h:152 #5 0x000055555558fc68 in QtPrivate::FunctionPointer<void (KWin::Xwl::Dnd::*)()>::call<QtPrivate::List<>, void>(void (KWin::Xwl::Dnd::*)(), KWin::Xwl::Dnd*, void**) (f=(void (KWin::Xwl::Dnd::*)(KWin::Xwl::Dnd * const)) 0x55555558e4e0 <KWin::Xwl::Dnd::endDrag()>, o=0x555555f28760, arg=0x7fffffffc0c0) at /opt/qt5/include/QtCore/qobjectdefs_impl.h:185 #6 0x000055555558fb95 in QtPrivate::QSlotObject<void (KWin::Xwl::Dnd::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x555555f251d0, r=0x555555f28760, a=0x7fffffffc0c0, ret=0x0) at /opt/qt5/include/QtCore/qobjectdefs_impl.h:418 #7 0x00007ffff43e696d in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7fffffffc0c0, r=0x555555f28760, this=0x555555f251d0) at ../../include/QtCore/../../../../../src/Qt5/qtbase/src/corelib/kernel/qobjectdefs_impl.h:398 #8 doActivate<false>(QObject*, int, void**) (sender=0x5555556bb810, signal_index=13, argv=0x7fffffffc0c0) at /home/david/projects/kde5/src/Qt5/qtbase/src/corelib/kernel/qobject.cpp:3886 #9 0x00007ffff43ddd6b in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=<optimized out>, local_signal_index=<optimized out>, argv=<optimized out>) at /home/david/projects/kde5/src/Qt5/qtbase/src/corelib/kernel/qobject.cpp:3946 #10 0x00007ffff4f514d8 in KWaylandServer::SeatInterface::dragEnded() (this=0x5555556bb810) at src/server/KWaylandServer_autogen/EWIEGA46WW/moc_seat_interface.cpp:420 #11 0x00007ffff4fbf1ae in KWaylandServer::SeatInterfacePrivate::endDrag(unsigned int) (this= 0x555555709520, serial=27) #12 0x00007ffff4fc21b3 in KWaylandServer::SeatInterface::notifyPointerButton(unsigned int, KWaylandServer::PointerButtonState) (this=0x5555556bb810, button=272, state=KWaylandServer::PointerButtonState::Released) at /home/david/projects/kde5/src/kde/workspace/kwayland-server/src/server/seat_interface.cpp:756 #13 0x00007ffff7890362 in KWin::DragAndDropInputFilter::pointerEvent(QMouseEvent*, unsigned int) (this=0x555555a0e460, event=0x7fffffffc938, nativeButton=272) at /home/david/projects/kde5/src/kde/workspace/kwin/src/input.cpp:1956 But because the drop event goes through KWayland::Client it is obviously async, but delivery of the end isnt. We either need to send both things through kwayland::client or none.
The above issue should now be fixed. This is currently only in master/5.23. I will backport sometime
Then it needs to be marked as RESOLVED :)
I said it fixes what was mentioned in the comment above, not the whole bug. I think there are still some issues left.
Yeah you're right, there are still unresolved cases. Dragging a file form Dolphin (Wayland) to Discord (XWayland), for example.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1362
Git commit c562a5c04fed1cad1c47cb59f57a99513d5ff9dc by David Redondo. Committed on 02/09/2021 at 09:17. Pushed by davidre into branch 'master'. DragWlToX: Do not send position before enter According to the spec, enter has to be send before position. Sending position first seems to confuse clients, before this change X windows only seemed to get data when the pointer left and entered them for a second time. Now it works straight away. M +1 -1 src/xwl/drag_wl.cpp https://invent.kde.org/plasma/kwin/commit/c562a5c04fed1cad1c47cb59f57a99513d5ff9dc