diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2009-05-17 06:25:18 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2009-05-17 06:25:18 +0000 |
commit | 2172c9147361829e4a65f1c918450b617c4d04d5 (patch) | |
tree | cb17cd04ca916afa99898347068eacc1b0a1dff6 /apps/gui/gwps.c | |
parent | 03ea24929779fd29ac95cb0bfd8945d269f3733d (diff) | |
download | rockbox-2172c9147361829e4a65f1c918450b617c4d04d5.tar.gz rockbox-2172c9147361829e4a65f1c918450b617c4d04d5.zip |
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
Diffstat (limited to 'apps/gui/gwps.c')
-rw-r--r-- | apps/gui/gwps.c | 19 |
1 files changed, 15 insertions, 4 deletions
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) | |||
295 | viewportmanager_set_statusbar(wpsbars); | 295 | viewportmanager_set_statusbar(wpsbars); |
296 | } | 296 | } |
297 | #ifdef HAVE_TOUCHSCREEN | 297 | #ifdef HAVE_TOUCHSCREEN |
298 | static int wps_get_touchaction(struct wps_data *data) | 298 | int wps_get_touchaction(struct wps_data *data) |
299 | { | 299 | { |
300 | short x,y; | 300 | short x,y; |
301 | short vx, vy; | 301 | short vx, vy; |
302 | int type = action_get_touchscreen_press(&x, &y); | 302 | int type = action_get_touchscreen_press(&x, &y); |
303 | int i; | 303 | int i; |
304 | static int last_action = ACTION_NONE; | ||
304 | struct touchregion *r; | 305 | struct touchregion *r; |
305 | if (type != BUTTON_REL) | 306 | bool repeated = (type == BUTTON_REPEAT); |
306 | return ACTION_TOUCHSCREEN; | 307 | bool released = (type == BUTTON_REL); |
307 | for (i=0; i<data->touchregion_count; i++) | 308 | for (i=0; i<data->touchregion_count; i++) |
308 | { | 309 | { |
309 | r = &data->touchregion[i]; | 310 | r = &data->touchregion[i]; |
@@ -320,9 +321,19 @@ static int wps_get_touchaction(struct wps_data *data) | |||
320 | /* now see if the point is inside this region */ | 321 | /* now see if the point is inside this region */ |
321 | if (vx >= r->x && vx < r->x+r->width && | 322 | if (vx >= r->x && vx < r->x+r->width && |
322 | vy >= r->y && vy < r->y+r->height) | 323 | vy >= r->y && vy < r->y+r->height) |
323 | return r->action; | 324 | { |
325 | if ((repeated && r->repeat) || | ||
326 | (released && !r->repeat)) | ||
327 | { | ||
328 | last_action = r->action; | ||
329 | return r->action; | ||
330 | } | ||
331 | } | ||
324 | } | 332 | } |
325 | } | 333 | } |
334 | if ((last_action == ACTION_WPS_SEEKBACK || last_action == ACTION_WPS_SEEKFWD)) | ||
335 | return ACTION_WPS_STOPSEEK; | ||
336 | last_action = ACTION_TOUCHSCREEN; | ||
326 | return ACTION_TOUCHSCREEN; | 337 | return ACTION_TOUCHSCREEN; |
327 | } | 338 | } |
328 | #endif | 339 | #endif |