Re: Multitouch review 4: touch devices and events



On Thu, Feb 02, 2012 at 12:24:54PM +0100, Carlos Garnacho wrote:
> 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. 

I should probably note that for GTK's functionality, I don't think
TouchOwnership handling is necessary right now. it may be in the future once
gesture recognition gets a lot fancier but even then it's a rather narrow
use-case.

> > 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.

fwiw, we had motion in one of the earlier drafts and went with "Update"
since the touch may update any axis but x/y in a single event. the name
"motion" seemed inappropriate for that. 

Cheers,
  Peter


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