1
0
Fork 0
forked from len0rd/rockbox

keyclick: Add a callback so screens can cancel a click. Add a generic list callback to stop clicks when we are at the end of the list

Change-Id: Iabb44a861dd7506cd883c1bdb0241303fa646746
This commit is contained in:
Jonathan Gordon 2012-01-12 22:28:36 +11:00
parent 5ef27368f1
commit eb2ea7f9ad
7 changed files with 60 additions and 10 deletions

View file

@ -876,12 +876,23 @@ void system_sound_play(enum system_sound sound)
params->amplitude * *params->setting);
}
}
/* Produce keyclick based upon button and global settings */
void keyclick_click(int button)
static keyclick_callback keyclick_current_callback = NULL;
static void* keyclick_data = NULL;
void keyclick_set_callback(keyclick_callback cb, void* data)
{
keyclick_current_callback = cb;
keyclick_data = data;
}
/* Produce keyclick based upon button and global settings */
void keyclick_click(int action)
{
int button;
static long last_button = BUTTON_NONE;
bool do_beep = false;
get_action_statuscode(&button);
/* Settings filters */
if (
#ifdef HAVE_HARDWARE_CLICK
@ -915,6 +926,11 @@ void keyclick_click(int button)
last_button = button;
else
last_button = BUTTON_NONE;
if (do_beep && keyclick_current_callback)
do_beep = keyclick_current_callback(action, keyclick_data);
keyclick_current_callback = NULL;
if (do_beep)
{
#ifdef HAVE_HARDWARE_CLICK