From 2172c9147361829e4a65f1c918450b617c4d04d5 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 17 May 2009 06:25:18 +0000 Subject: get repeat/hold actions working on the touchscreen WPS. prepending an action with & means that this will only get triggered if you hold down the area. cabbie WPS updated so the fwd/rwd icons will do that when held or skip fwd/back if just pressed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20974 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'apps/gui/gwps.c') diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index ae9dc453f5..c89a6fcbb4 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c @@ -295,15 +295,16 @@ void gwps_draw_statusbars(void) viewportmanager_set_statusbar(wpsbars); } #ifdef HAVE_TOUCHSCREEN -static int wps_get_touchaction(struct wps_data *data) +int wps_get_touchaction(struct wps_data *data) { short x,y; short vx, vy; int type = action_get_touchscreen_press(&x, &y); int i; + static int last_action = ACTION_NONE; struct touchregion *r; - if (type != BUTTON_REL) - return ACTION_TOUCHSCREEN; + bool repeated = (type == BUTTON_REPEAT); + bool released = (type == BUTTON_REL); for (i=0; itouchregion_count; i++) { r = &data->touchregion[i]; @@ -320,9 +321,19 @@ static int wps_get_touchaction(struct wps_data *data) /* now see if the point is inside this region */ if (vx >= r->x && vx < r->x+r->width && vy >= r->y && vy < r->y+r->height) - return r->action; + { + if ((repeated && r->repeat) || + (released && !r->repeat)) + { + last_action = r->action; + return r->action; + } + } } } + if ((last_action == ACTION_WPS_SEEKBACK || last_action == ACTION_WPS_SEEKFWD)) + return ACTION_WPS_STOPSEEK; + last_action = ACTION_TOUCHSCREEN; return ACTION_TOUCHSCREEN; } #endif -- cgit v1.2.3