diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-03-04 07:45:12 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-03-04 07:45:12 +0000 |
| commit | ca701bf62e192ad8cbaea38653e1e44874fede50 (patch) | |
| tree | c5232585bfabf3601a19f9aa73a165aed67c2d84 /apps/action.c | |
| parent | 598629c3bf4bf683812c374af7791f06777873f7 (diff) | |
| download | rockbox-ca701bf62e192ad8cbaea38653e1e44874fede50.zip rockbox-ca701bf62e192ad8cbaea38653e1e44874fede50.tar.gz rockbox-ca701bf62e192ad8cbaea38653e1e44874fede50.tar.bz2 rockbox-ca701bf62e192ad8cbaea38653e1e44874fede50.tar.xz | |
Add a function to get the actual button that was pressed (and some
status codes) instead of the action. Use this to figure out which screen
to do prev/next page on in the lists
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12580 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/action.c')
| -rw-r--r-- | apps/action.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/apps/action.c b/apps/action.c index 30eccb8..7667e4d 100644 --- a/apps/action.c +++ b/apps/action.c @@ -31,6 +31,8 @@ static bool ignore_until_release = false; static int last_button = BUTTON_NONE; +static int last_action = ACTION_NONE; +static bool repeated = false; /* software keylock stuff */ #ifndef HAS_BUTTON_HOLD @@ -107,7 +109,6 @@ static int get_action_worker(int context, int timeout, else button = button_get_w_tmo(timeout); - if (button == BUTTON_NONE || button&SYS_EVENT) { return button; @@ -185,6 +186,11 @@ static int get_action_worker(int context, int timeout, return ACTION_REDRAW; } #endif + if (ret == last_action) + repeated = true; + else + repeated = false; + last_button = button; return ret; } @@ -224,3 +230,18 @@ bool is_keys_locked(void) return (screen_has_lock && (keys_locked == true)); } #endif + +int get_action_statuscode(int *button) +{ + int ret = 0; + if (button) + *button = last_button; + + if (last_button&BUTTON_REMOTE) + ret |= ACTION_REMOTE; + if (repeated) + ret |= ACTION_REPEAT; + if (ignore_until_release) + ret |= ACTION_IGNORING; + return ret; +} |