summaryrefslogtreecommitdiff
path: root/apps/action.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/action.c')
-rw-r--r--apps/action.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/action.c b/apps/action.c
index fc10c927e5..2eef7d9d7b 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -37,6 +37,7 @@
#if defined(HAVE_LCD_BITMAP) && !defined(BOOTLOADER)
#include "language.h"
#endif
+#include "viewport.h"
static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to
work on startup */
@@ -386,6 +387,24 @@ int action_get_touchscreen_press(short *x, short *y)
return BUTTON_REPEAT|BUTTON_REL;
return BUTTON_TOUCHSCREEN;
}
+
+int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp)
+{
+ short x, y;
+ int ret;
+
+ ret = action_get_touchscreen_press(&x, &y);
+
+ if (ret != BUTTON_NONE && viewport_point_within_vp(vp, x, y))
+ {
+ *x1 = x - vp->x;
+ *y1 = y - vp->y;
+ return ret;
+ }
+ if (ret & BUTTON_TOUCHSCREEN)
+ return ACTION_UNKNOWN;
+ return BUTTON_NONE;
+}
#endif
/* Don't let get_action*() return any ACTION_* values untill the current buttons