gesture_funcs_t

Touch event handling functions.

Synopsis:

typedef struct  {
    void(* free )(struct gesture_base *gesture);
    gesture_state_e(* process_event )(struct contact_id_map *map, struct gesture_base *gesture, mtouch_event_t *event, int *consumed);
    void(* reset )(struct gesture_base *gesture);
}gesture_funcs_t;

Data:

void(* free
gesture_state_e(* process_event
void(* reset

Library:

libgestures

Description:

This datatype consists of pointers to functions that handle touch events by updating the gesture state, resetting the gesture data structures or freeing memory associated with the gesture. The following functions must be defined for each gesture:

  • process_event()

  • reset()

  • free()

The process_event() callback function is responsible for state handling and returning the new (or unchanged) gesture state. The list of gesture states, with valid transitions in brackets, consists of:

  • UNRECOGNIZED (recognized, updating, complete, failed)

  • RECOGNIZED (updating, complete, failed)

  • UPDATING (complete, failed)

  • COMPLETE

  • FAILED

Discrete gestures do not use the RECOGNIZED or UPDATING states; they transition directly from UNRECOGNIZED to FAILED or COMPLETE.

The reset() callback function resets the gesture-specific data structures to the initial state.

The free() callback function frees all memory associated with the gesture that was allocated by the gesture's alloc() function.