diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-10-11 20:11:48 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-10-11 20:11:48 +0000 |
commit | 891c446302d341d2e8f6f2da54343589bf46d0e4 (patch) | |
tree | bb5cf557c25f5a508430937f5c42d80c622dec6e /apps/action.h | |
parent | 6cea8c1e1aa9a7888ceec0cf35181632b5b0eb29 (diff) | |
download | rockbox-891c446302d341d2e8f6f2da54343589bf46d0e4.tar.gz 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.h | 24 |
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 @@ | |||
22 | 22 | ||
23 | #include "stdbool.h" | 23 | #include "stdbool.h" |
24 | #include "button.h" | 24 | #include "button.h" |
25 | #include "viewport.h" | ||
25 | 26 | ||
26 | #define TIMEOUT_BLOCK -1 | 27 | #define TIMEOUT_BLOCK -1 |
27 | #define TIMEOUT_NOBLOCK 0 | 28 | #define TIMEOUT_NOBLOCK 0 |
@@ -327,12 +328,25 @@ int get_action_statuscode(int *button); | |||
327 | intptr_t get_action_data(void); | 328 | intptr_t get_action_data(void); |
328 | 329 | ||
329 | #ifdef HAVE_TOUCHSCREEN | 330 | #ifdef HAVE_TOUCHSCREEN |
330 | /* return BUTTON_NONE on error | 331 | /* return BUTTON_NONE on error |
331 | BUTTON_REPEAT if repeated press | 332 | * BUTTON_REPEAT if repeated press |
332 | BUTTON_REL if its a short press | 333 | * BUTTON_REPEAT|BUTTON_REL if release after repeated press |
333 | BUTTON_TOUCHSCREEN otherwise | 334 | * BUTTON_REL if its a short press = release after press |
334 | */ | 335 | * BUTTON_TOUCHSCREEN if press |
336 | */ | ||
335 | int action_get_touchscreen_press(short *x, short *y); | 337 | int action_get_touchscreen_press(short *x, short *y); |
338 | |||
339 | /* | ||
340 | * wrapper action_get_touchscreen_press() | ||
341 | * to filter the touchscreen coordinates through a viewport | ||
342 | * | ||
343 | * returns the action and x1, y1 relative to the viewport if | ||
344 | * the press was within the viewport, | ||
345 | * ACTION_UNKNOWN (and x1, y1 untouched) if the press was outside | ||
346 | * BUTTON_NONE else | ||
347 | * | ||
348 | **/ | ||
349 | int action_get_touchscreen_press_in_vp(short *x1, short *y1, struct viewport *vp); | ||
336 | #endif | 350 | #endif |
337 | 351 | ||
338 | /* Don't let get_action*() return any ACTION_* values untill the current buttons | 352 | /* Don't let get_action*() return any ACTION_* values untill the current buttons |