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.tar.gz rockbox-ca701bf62e192ad8cbaea38653e1e44874fede50.zip |
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 30eccb8d81..7667e4dd12 100644 --- a/apps/action.c +++ b/apps/action.c | |||
@@ -31,6 +31,8 @@ | |||
31 | 31 | ||
32 | static bool ignore_until_release = false; | 32 | static bool ignore_until_release = false; |
33 | static int last_button = BUTTON_NONE; | 33 | static int last_button = BUTTON_NONE; |
34 | static int last_action = ACTION_NONE; | ||
35 | static bool repeated = false; | ||
34 | 36 | ||
35 | /* software keylock stuff */ | 37 | /* software keylock stuff */ |
36 | #ifndef HAS_BUTTON_HOLD | 38 | #ifndef HAS_BUTTON_HOLD |
@@ -107,7 +109,6 @@ static int get_action_worker(int context, int timeout, | |||
107 | else | 109 | else |
108 | button = button_get_w_tmo(timeout); | 110 | button = button_get_w_tmo(timeout); |
109 | 111 | ||
110 | |||
111 | if (button == BUTTON_NONE || button&SYS_EVENT) | 112 | if (button == BUTTON_NONE || button&SYS_EVENT) |
112 | { | 113 | { |
113 | return button; | 114 | return button; |
@@ -185,6 +186,11 @@ static int get_action_worker(int context, int timeout, | |||
185 | return ACTION_REDRAW; | 186 | return ACTION_REDRAW; |
186 | } | 187 | } |
187 | #endif | 188 | #endif |
189 | if (ret == last_action) | ||
190 | repeated = true; | ||
191 | else | ||
192 | repeated = false; | ||
193 | |||
188 | last_button = button; | 194 | last_button = button; |
189 | return ret; | 195 | return ret; |
190 | } | 196 | } |
@@ -224,3 +230,18 @@ bool is_keys_locked(void) | |||
224 | return (screen_has_lock && (keys_locked == true)); | 230 | return (screen_has_lock && (keys_locked == true)); |
225 | } | 231 | } |
226 | #endif | 232 | #endif |
233 | |||
234 | int get_action_statuscode(int *button) | ||
235 | { | ||
236 | int ret = 0; | ||
237 | if (button) | ||
238 | *button = last_button; | ||
239 | |||
240 | if (last_button&BUTTON_REMOTE) | ||
241 | ret |= ACTION_REMOTE; | ||
242 | if (repeated) | ||
243 | ret |= ACTION_REPEAT; | ||
244 | if (ignore_until_release) | ||
245 | ret |= ACTION_IGNORING; | ||
246 | return ret; | ||
247 | } | ||