Re: Multitouch review 5: Multitouch events


On mié, 2012-02-01 at 09:57 -0500, Matthias Clasen wrote:
>   GdkTouchCluster
>   gdk_window_{create,remove}_touch_cluster
>   gdk_touch_cluster_{add,remove}_touch
>   GdkEventMultiTouch
>   GdkWidget::multitouch-event signal
>   gdk_event_get_touch_area
> GdkTouchCluster objects are used to group touch-event streams for
> multiple touch ids together into a single multi-touch event stream. It
> is the applications responsibility to create a touch cluster object
> for every (toplevel) window that it wants to handle multitouch events
> on, and to add touch ids to the cluster when they first appear in a
> TOUCH_PRESS event. When a touch id is added to a cluster, GDK no
> longer generates TOUCH_PRESS/RELEASE/MOTION events for it; instead,
> GDK_MULTITOUCH_ADDED/UPDATED/REMOVED events are generated. There is no
> separate event mask for multitouch events, GTK_TOUCH_MASK selects both
> touch and multitouch events. Internally, GDK always receives touch
> events, in order to do pointer emulation.
> On the GTK+ side, GdkEventMultiTouch events are treated like other
> touch events, but they have a dedicated ::multitouch-event signal.
> Finally, it is possible to get area information about touches with
> gdk_event_get_touch_area, if the device provides such information.
> Questions, comments:
> - The way applications are required to create touch clusters and add
> touch ids to it looks fairly manual - it means you have to handle both
> touch and multitouch events. Would it be possible to make that more
> automatic ? E.g. we could have a 'enable-multitouch' flag on GdkWindow
> and then create the cluster automatically and only ever generate
> multitouch events if it is set.

We can certainly add helper API for the simplest case were one touch
cluster is needed. For cases with different interaction areas within one
window (as in the gtk3-demo test) you still would be better creating
those by hand.

> - Does the separation into touch and multitouch events buy us much, or
> would it be conceivable to just treat non-multi-touch devices like
> multitouch devices with 'max touch #' == 1 ?

It could mean a lot of work if we ever want to offer the possibility of
just enabling GDK_TOUCH_MASK on random widgets and get away with it, at
least the most basic ones would need a ::multitouch-event handler then.

> - Are there use cases for treating some touch events as part of a
> cluster, while others are treated separately at the same time ?

It was more about having multitouch events on several clusters, as those
do not have bounding area info, the app is to decide there.


> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]