Multitouch review 5: Multitouch events



API
  GdkTouchCluster
  gdk_window_{create,remove}_touch_cluster
  gdk_touch_cluster_{add,remove}_touch
  GdkEventMultiTouch
  GDK_MULTITOUCH_{ADDED,UPDATED,REMOVED} event types
  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.

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

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


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