touchscreen: Integrate gesture API with action system

Provide a default gesture object in the action system which will
be kept up to date with touch events automatically. This reduces
the boilerplate needed to handle touch input.

Change-Id: I76f51ac2c3e3a0da204707d62e91a175c5f8c76a
This commit is contained in:
Aidan MacDonald 2022-07-12 13:38:02 +01:00 committed by Solomon Peachy
parent bb1e0b48a0
commit 8aae723853
2 changed files with 38 additions and 0 deletions

View file

@ -23,6 +23,7 @@
#include "stdbool.h"
#include "button.h"
#include "viewport.h"
#include "gesture.h"
#define TIMEOUT_BLOCK -1
#define TIMEOUT_NOBLOCK 0
@ -418,6 +419,18 @@ intptr_t get_action_data(void);
/* Return a touch event and screen coordinates of the touch. */
int action_get_touch_event(struct touchevent *ev);
/* Action system gesture recognition */
void action_gesture_reset(void);
bool action_gesture_get_event_in_vp(struct gesture_event *gevt,
const struct viewport *vp);
bool action_gesture_is_valid(void);
bool action_gesture_is_pressed(void);
static inline bool action_gesture_get_event(struct gesture_event *gevt)
{
return action_gesture_get_event_in_vp(gevt, NULL);
}
/* DEPRECATED, do not use these anymore */
int action_get_touchscreen_press(short *x, short *y);
int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp);