summaryrefslogtreecommitdiffstats
path: root/apps/action.h
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-10-11 20:11:48 +0000
committerThomas Martitz <kugel@rockbox.org>2009-10-11 20:11:48 +0000
commit891c446302d341d2e8f6f2da54343589bf46d0e4 (patch)
treebb5cf557c25f5a508430937f5c42d80c622dec6e /apps/action.h
parent6cea8c1e1aa9a7888ceec0cf35181632b5b0eb29 (diff)
downloadrockbox-891c446302d341d2e8f6f2da54343589bf46d0e4.tar.gz
rockbox-891c446302d341d2e8f6f2da54343589bf46d0e4.tar.bz2
rockbox-891c446302d341d2e8f6f2da54343589bf46d0e4.zip
Add a action helper for touchscreen targets to only receive the touchpress coordinates if they're in the passed viewport. Also, fixes the coordinates to be relaitve to the viewport.
Use it in the color picker screen. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23116 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/action.h')
-rw-r--r--apps/action.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/apps/action.h b/apps/action.h
index 24250ef869..8d8e8f50fd 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -22,6 +22,7 @@
#include "stdbool.h"
#include "button.h"
+#include "viewport.h"
#define TIMEOUT_BLOCK -1
#define TIMEOUT_NOBLOCK 0
@@ -327,12 +328,25 @@ 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_REL if its a short press
- BUTTON_TOUCHSCREEN otherwise
-*/
+/* return BUTTON_NONE on error
+ * BUTTON_REPEAT if repeated press
+ * BUTTON_REPEAT|BUTTON_REL if release after repeated press
+ * BUTTON_REL if its a short press = release after press
+ * BUTTON_TOUCHSCREEN if press
+ */
int action_get_touchscreen_press(short *x, short *y);
+
+/*
+ * 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
+ *
+ **/
+int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp);
#endif
/* Don't let get_action*() return any ACTION_* values untill the current buttons