From ca701bf62e192ad8cbaea38653e1e44874fede50 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 4 Mar 2007 07:45:12 +0000 Subject: 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 --- apps/action.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'apps/action.c') diff --git a/apps/action.c b/apps/action.c index 30eccb8d81..7667e4dd12 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; +} -- cgit v1.2.3