touchscreen: Update action system touch event reporting

Add a cleaner API for reporting touch events and deprecate the old
action_get_touchscreen_press() API. The old API is now emulated by
using the new one internally.

Change-Id: I001378e66f9c81806f134f011420d671954fcde2
This commit is contained in:
Aidan MacDonald 2022-04-23 15:32:32 +01:00 committed by Solomon Peachy
parent fa164f89e0
commit 9e254acab3
3 changed files with 100 additions and 67 deletions

View file

@ -415,24 +415,11 @@ int get_action_statuscode(int *button);
intptr_t get_action_data(void);
#ifdef HAVE_TOUCHSCREEN
/* return BUTTON_NONE on error
* BUTTON_REPEAT if repeated press
* BUTTON_REPEAT|BUTTON_REL if release after repeated press
* BUTTON_REL if it's a short press = release after press
* BUTTON_TOUCHSCREEN if press
*/
int action_get_touchscreen_press(short *x, short *y);
/* Return a touch event and screen coordinates of the touch. */
int action_get_touch_event(struct touchevent *ev);
/*
* wrapper action_get_touchscreen_press()
* to filter the touchscreen coordinates through a viewport
*
* returns the action and x1, y1 relative to the viewport if
* the press was within the viewport,
* ACTION_UNKNOWN (and x1, y1 untouched) if the press was outside
* BUTTON_NONE else
*
**/
/* 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);
#endif