diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-06-04 13:52:02 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-06-04 13:52:02 +0000 |
commit | 63c85110d0d7cf6ea33b37cd7923fb65523ac749 (patch) | |
tree | 822cad3924dc5400095b5df6d6d42accabd19e20 /apps | |
parent | 54c73a24b6841efb06ee812831892960e5584e26 (diff) | |
download | rockbox-63c85110d0d7cf6ea33b37cd7923fb65523ac749.tar.gz rockbox-63c85110d0d7cf6ea33b37cd7923fb65523ac749.zip |
Fix FS#7242 - the action code now checks the time difference between events to decide if its a repeat or not. a repeat event is now if the previous action was the same and it occured < HZ/10 ticks ago
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13551 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/action.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/action.c b/apps/action.c index 80053e7646..d9f04a8c89 100644 --- a/apps/action.c +++ b/apps/action.c | |||
@@ -34,6 +34,9 @@ static int last_button = BUTTON_NONE; | |||
34 | static int last_action = ACTION_NONE; | 34 | static int last_action = ACTION_NONE; |
35 | static bool repeated = false; | 35 | static bool repeated = false; |
36 | 36 | ||
37 | #define REPEAT_WINDOW_TICKS HZ/10 | ||
38 | static int last_action_tick = 0; | ||
39 | |||
37 | /* software keylock stuff */ | 40 | /* software keylock stuff */ |
38 | #ifndef HAS_BUTTON_HOLD | 41 | #ifndef HAS_BUTTON_HOLD |
39 | static bool keys_locked = false; | 42 | static bool keys_locked = false; |
@@ -186,13 +189,15 @@ static int get_action_worker(int context, int timeout, | |||
186 | return ACTION_REDRAW; | 189 | return ACTION_REDRAW; |
187 | } | 190 | } |
188 | #endif | 191 | #endif |
189 | if (ret == last_action) | 192 | if ((current_tick - last_action_tick < REPEAT_WINDOW_TICKS) |
193 | && (ret == last_action)) | ||
190 | repeated = true; | 194 | repeated = true; |
191 | else | 195 | else |
192 | repeated = false; | 196 | repeated = false; |
193 | 197 | ||
194 | last_button = button; | 198 | last_button = button; |
195 | last_action = ret; | 199 | last_action = ret; |
200 | last_action_tick = current_tick; | ||
196 | return ret; | 201 | return ret; |
197 | } | 202 | } |
198 | 203 | ||