Re: Multitouch review 4: touch devices and events



On mié, 2012-02-01 at 08:31 -0500, Matthias Clasen wrote:
> API
>   GDK_SOURCE_TOUCH device type
>   GDK_CROSSING_STATE_{CHANGED,TOUCH_PRESS,TOUCH_RELEASE,DEVICE_SWITCH}
>   GDK_TOUCH_MASK event mask
>   GDK_TOUCH_{MOTION,PRESS,RELEASE} event types
>   gdk_event_get_touch_id
> 
> XI2.2 emits TouchBegin, TouchEnd, TouchUpdate and TouchOwnership
> events. GDK translates the first three into
> GDK_TOUCH_PRESS/RELEASE/MOTION and currently ignores TouchOwnership
> altogether. The touch_id is used to tie events together that are
> generated by the same 'touch'. There is only a single event mask
> selecting all the touch (and multitouch) events. The new
> TOUCH_PRESS/RELEASE crossing modes are used when generating synthetic
> crossing events when a touch begins or end;
> GDK_CROSSING_STATE_DEVICE_SWITCH is used when a different slave takes
> control of the pointer (e.g touch -> mouse).

Worth noting, only the touch sequence emulating pointer events gets to
generate crossing events, pure touch events don't generate those, and
rely on the implicit grab as the event window is not supposed to change
during a sequence. (there's an implicit grab per-touch)

> 
> Questions, comments:
> 
> - Would it be better to align the new event type names with the XI2
> names, ie GDK_TOUCH_{BEGIN,UPDATE,END} ?

It could make sense, certainly those resemble better the semantics of a
touch operation, the GDK enum values were added before the XI2 event
type names settled down, but didn't change with them.

> 
> - The GdkInputSource enumeration is not very usefully documented. We
> should improve that to at least state what kind of events the
> different device types will generate. What are the typical uses of
> this enumeration ? There's also some discussion of device types in
> bugzilla [2].

Basically, only GDK_SOURCE_TOUCH devices get to generate a different
event set. But I agree GdkInputSource has grown more important now, so
deserves clearer documentation.

  Carlos




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