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 731371 - Gtk gets confused by wayland touch events
Gtk gets confused by wayland touch events
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
3.13.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-06-08 15:29 UTC by Sjoerd Simons
Modified: 2014-06-12 10:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Ensure GdkEvent has a non-null touch sequence for touch events (1.29 KB, patch)
2014-06-08 15:37 UTC, Sjoerd Simons
none Details | Review
Compared to previous fix casting warning (1.30 KB, patch)
2014-06-08 20:34 UTC, Sjoerd Simons
reviewed Details | Review

Description Sjoerd Simons 2014-06-08 15:29:47 UTC
When using a touchscreen under weston, Gtk+ sometimes seems to get confused about its inputs. E.g. when running gtk3-demo, scrolling in the demo list with the touchscreen causes mouse events to be ignored afterwards.

Some digging revealed that this is due to weston numbering its touch events sequence from 0 and gdks wayland backend simply using GUINT_TO_POINTER to set the touch.sequence field. This causes gdk_event_get_touch_sequence to return NULL which confuses other parts of Gdk/Gtk.
Comment 1 Sjoerd Simons 2014-06-08 15:37:24 UTC
Created attachment 278100 [details] [review]
Ensure GdkEvent has a non-null touch sequence for touch events
Comment 2 Sjoerd Simons 2014-06-08 20:34:38 UTC
Created attachment 278104 [details] [review]
Compared to previous fix casting warning
Comment 3 Carlos Garnacho 2014-06-09 14:45:41 UTC
Comment on attachment 278104 [details] [review]
Compared to previous fix casting warning

Thanks Sjoerd for the patch! having slot id=0 is indeed possible on wayland... I would however find more convenient to have the event sequence tied somehow to the slot ID (say id+1), that'd be helpful for debugging situations above GDK, although eventually there should maybe be a gdk_wayland_event_sequence_get_slot().

The way weston/mutter make use of mtdev should ensure slot is kept between 0..max_dev_touches-1, if a compositor for some reason implements this as a counter, it could overflow to 0 at some point, but it wouldn't be worse than X11 in that regard...
Comment 4 Carlos Garnacho 2014-06-09 14:55:01 UTC
I forgot to mention, IMO it's fine to push after that change
Comment 5 Sjoerd Simons 2014-06-12 10:36:19 UTC
committed:

commit 5b118a9fd768f752f3e770d7734596e239de942d
Author: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Date:   Sun Jun 8 17:21:14 2014 +0200

    wayland: Ensure the touch sequence pointer value is non-null
    
    Weston numbers its touch sequences ids starting from 0, thus simply
    setting the GtkEvents touch.sequence to the touch id value typically
    causes gdk_event_get_event_sequence to return NULL. Unfortunately this
    confuses other parts of GDK.
    
    As both weston & mutter keep the sequence id between 0..max_dev_touches
    -1 simply use + 1 to keep the id > 0. While this isn't entirely correct
    (compositor could send -1 as the touch id), this keeps the touch id in
    gtk tied to the touch id from weston which is useful for debugging. A
    more thorough solution could be done when it turns out this is an issue
    in practise
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731371