After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 741066 - DnD fails on touch
DnD fails on touch
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
3.14.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-12-03 14:17 UTC by Jonny Lamb
Modified: 2015-11-19 23:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
workarounds for the crashers (1.42 KB, patch)
2014-12-03 14:18 UTC, Jonny Lamb
none Details | Review
wayland: Ensure we have a drop-side GdkDragContext without pointer (4.57 KB, patch)
2015-11-19 23:15 UTC, Carlos Garnacho
committed Details | Review

Description Jonny Lamb 2014-12-03 14:17:02 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):

  • #0 raise
    at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c line 46
  • #1 g_logv
    at gmessages.c line 1041
  • #2 g_log
    at gmessages.c line 1079
  • #3 g_return_if_fail_warning
    at gmessages.c line 1088
  • #4 gdk_wayland_window_get_wl_surface
    from /usr/lib/libgdk-3.so.0
  • #5 _gdk_wayland_window_drag_begin
    from /usr/lib/libgdk-3.so.0
  • #6 gdk_drag_begin_for_device
    from /usr/lib/libgdk-3.so.0
  • #7 gtk_drag_begin_internal
    from /usr/lib/libgtk-3.so.0
  • #8 gtk_drag_source_event_cb
    from /usr/lib/libgtk-3.so.0
  • #9 _gtk_marshal_BOOLEAN__BOXED
    from /usr/lib/libgtk-3.so.0
  • #10 g_closure_invoke
    at gclosure.c line 768
  • #11 signal_emit_unlocked_R
    at gsignal.c line 3553
  • #12 g_signal_emit_valist
    at gsignal.c line 3319
  • #13 g_signal_emit
    at gsignal.c line 3365
  • #14 gtk_widget_real_touch_event
    from /usr/lib/libgtk-3.so.0
  • #15 _gtk_marshal_BOOLEAN__BOXEDv
    from /usr/lib/libgtk-3.so.0
  • #16 g_type_class_meta_marshalv
    at gclosure.c line 988
  • #17 _g_closure_invoke_va
    at gclosure.c line 831
  • #18 g_signal_emit_valist
    at gsignal.c line 3218
  • #19 g_signal_emit
    at gsignal.c line 3365
  • #20 gtk_widget_event_internal.part.25
    from /usr/lib/libgtk-3.so.0
  • #21 propagate_event
    from /usr/lib/libgtk-3.so.0
  • #22 gtk_main_do_event
    from /usr/lib/libgtk-3.so.0
  • #23 _gdk_event_emit
    from /usr/lib/libgdk-3.so.0
  • #24 gdk_event_source_dispatch
    from /usr/lib/libgdk-3.so.0
  • #25 g_main_dispatch
    at gmain.c line 3064
  • #26 g_main_context_dispatch
    at gmain.c line 3663
  • #27 g_main_context_iterate
    at gmain.c line 3734
  • #28 g_main_context_iterate
    at gmain.c line 3671
  • #29 g_main_context_iteration
    at gmain.c line 3795
  • #30 g_application_run
    at gapplication.c line 2282
  • #31 main

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.
Comment 1 Jonny Lamb 2014-12-03 14:18:37 UTC
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.
Comment 2 Matthias Clasen 2015-11-17 20:45:04 UTC
Still get this crash when using the image drag example in gtk3-demo's clipboard example with a touchscreen.
Comment 3 Carlos Garnacho 2015-11-19 23:15:16 UTC
The following fix has been pushed:
c4f5fd1 wayland: Ensure we have a drop-side GdkDragContext without pointer
Comment 4 Carlos Garnacho 2015-11-19 23:15:21 UTC
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.
Comment 5 Carlos Garnacho 2015-11-19 23:16:42 UTC
This patch fixed the drag context missing when there's no pointer capability, the other crash was fixed by the previous commits in master.