diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2011-03-27 07:23:38 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2011-03-27 07:23:38 +0000 |
commit | 443b1349830912add7211e07557029b9c185d948 (patch) | |
tree | bffa8efdf04b0eb8d3502e0af4691c9a257f1c8f /apps/gui/skin_engine/skin_touchsupport.c | |
parent | 86c4ec7277ac1c2a130a9ac1a3500c8360af5c7e (diff) |
Fix touchregions muting volume, and change &<action> to mean 'needs long press but only fire once'. Use *<action> for 'long press and allow repeats'
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29653 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine/skin_touchsupport.c')
-rw-r--r-- | apps/gui/skin_engine/skin_touchsupport.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c index e1a7d0688e..beb6780c3c 100644 --- a/apps/gui/skin_engine/skin_touchsupport.c +++ b/apps/gui/skin_engine/skin_touchsupport.c @@ -62,6 +62,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, bool released = (type == BUTTON_REL); bool pressed = (type == BUTTON_TOUCHSCREEN); struct skin_token_list *regions = data->touchregions; + bool needs_repeat; while (regions) { @@ -72,6 +73,7 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, regions = regions->next; continue; } + needs_repeat = r->press_length != PRESS; /* check if it's inside this viewport */ if (viewport_point_within_vp(&(r->wvp->vp), x, y)) { /* reposition the touch inside the viewport since touchregions @@ -87,22 +89,10 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, vy -= r->y; - switch(r->type) + switch(r->action) { - case WPS_TOUCHREGION_ACTION: - if (r->armed && ((repeated && r->repeat) || (released && !r->repeat))) - { - last_action = r->action; - returncode = r->action; - temp = r; - } - if (pressed) - { - r->armed = true; - r->last_press = current_tick; - } - break; - default: + case ACTION_TOUCH_SCROLLBAR: + case ACTION_TOUCH_VOLUME: if (edge_offset) { if(r->width > r->height) @@ -112,8 +102,22 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, if (r->reverse_bar) *edge_offset = 100 - *edge_offset; } - returncode = r->type; temp = r; + returncode = r->action; + break; + default: + if (r->armed && ((repeated && needs_repeat) || + (released && !needs_repeat))) + { + last_action = r->action; + returncode = r->action; + temp = r; + } + if (pressed) + { + r->armed = true; + r->last_press = current_tick; + } break; } } @@ -126,6 +130,8 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset, skin_disarm_touchregions(data); if (retregion && temp) *retregion = temp; + if (temp && temp->press_length == LONG_PRESS) + temp->armed = false; if (returncode != ACTION_NONE) { |