mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-17 09:02:38 -05:00
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
This commit is contained in:
parent
54c73a24b6
commit
63c85110d0
1 changed files with 6 additions and 1 deletions
|
|
@ -34,6 +34,9 @@ static int last_button = BUTTON_NONE;
|
|||
static int last_action = ACTION_NONE;
|
||||
static bool repeated = false;
|
||||
|
||||
#define REPEAT_WINDOW_TICKS HZ/10
|
||||
static int last_action_tick = 0;
|
||||
|
||||
/* software keylock stuff */
|
||||
#ifndef HAS_BUTTON_HOLD
|
||||
static bool keys_locked = false;
|
||||
|
|
@ -186,13 +189,15 @@ static int get_action_worker(int context, int timeout,
|
|||
return ACTION_REDRAW;
|
||||
}
|
||||
#endif
|
||||
if (ret == last_action)
|
||||
if ((current_tick - last_action_tick < REPEAT_WINDOW_TICKS)
|
||||
&& (ret == last_action))
|
||||
repeated = true;
|
||||
else
|
||||
repeated = false;
|
||||
|
||||
last_button = button;
|
||||
last_action = ret;
|
||||
last_action_tick = current_tick;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue