gesture_funcs_t

Updated: October 26, 2022

Touch event handling functions

Synopsis:

#include <gestures/>
typedef struct gesture_funcs_t {
    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)(struct gesture_base *gesture)
Free all the memory associated with the gesture that was allocated by the gesture's alloc() function.
Arguments
  • gesture The gesture whose memory is to be freed.
gesture_state_e (*process_event)(struct contact_id_map *map, struct gesture_base *gesture, mtouch_event_t *event, int *consumed)
Manage the state transitions and return the new, or unchanged, gesture state.
Arguments
  • map Identifier used to identify the mtouch event.
  • gesture Gesture recognizer whose state is being managed.
  • event Mtouch event that has been received.
  • consumed Indicator that gesture recognizer is finished recoginzing a gesture based on mtouch events received.
Returns
  • The new state of the gesture recognizer.
void (*reset)(struct gesture_base *gesture)
Reset the gesture-specific data structures to their initial state.
Arguments
  • gesture Gesture recognizer whose specific data structures are to be returned to initial state.

Library:

libgestures

Description:

This data type consists of pointers to functions that handle mtouch 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 of your custom gesture recognizer:
  • (*process_event)()
  • (*reset)()
  • (*free)()