GNOME Bugzilla – Bug 741066
DnD fails on touch
Last modified: 2015-11-19 23:16:42 UTC
DnD on touch with no mouse connected can't work for a few reasons. At first these two messages were appearing in the log: (gtk3-demo:3443): Gdk-CRITICAL **: gdk_wayland_window_get_wl_surface: assertion 'GDK_IS_WAYLAND_WINDOW (window)' failed (gtk3-demo:3443): Gdk-ERROR **: error marshalling arguments for start_drag (signature ?oo?ou): null value passed for arg 1 The latter is obviously caused by the former so I got a backtrace for the first critical (sorry about broken debug symbols):
+ Trace 234393
The problem is in the implementation of gdk_wayland_device_window_at_position(), which relies on the GdkWindow* GdkWaylandDeviceData.pointer_focus being set. I wrote a patch to try and use a touch if there is one present, which stops the crash and gives me the correct return value in my specific case, but probably isn't a great general pupose fix. After that, it segfaults again because of the lack of GdkWaylandDeviceData.drop_context which is set when we get the capabilities of the wl_seat, but only if we have a pointer. I tried fixing that by creating a drag context based on the touch device we have. This stops any futher crashers and errors but DnD still doesn't really work properly. I don't really know these components too well so I thought I'd just open a bug with my findings and hope someone else has some better ideas.
Created attachment 292070 [details] [review] workarounds for the crashers This patch stops the errors and segfaults. The first part isn't so bad but the second setting the drag context isn't so good. Hopefully this is clear enough. Let me know if more information is needed.
Still get this crash when using the image drag example in gtk3-demo's clipboard example with a touchscreen.
The following fix has been pushed: c4f5fd1 wayland: Ensure we have a drop-side GdkDragContext without pointer
Created attachment 315929 [details] [review] wayland: Ensure we have a drop-side GdkDragContext without pointer This GdkDragContext should be created even if we don't have pointer capabilities. Make it created on add_seat(), and only set the device on wl_seat.capabilities, so it can be set to either master pointer.
This patch fixed the drag context missing when there's no pointer capability, the other crash was fixed by the previous commits in master.