diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2012-01-12 22:28:36 +1100 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2012-01-12 22:28:36 +1100 |
commit | eb2ea7f9ad4c4e2cce390f8fe73e17698fa9a906 (patch) | |
tree | 64cd1f227d75a5758b52d9b49ae7bdf23f6dbf83 /apps/misc.c | |
parent | 5ef27368f1bcbe31fb27072983d7a29df8de6845 (diff) |
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
Diffstat (limited to 'apps/misc.c')
-rw-r--r-- | apps/misc.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/apps/misc.c b/apps/misc.c index 3c55395a42..52e891e0c2 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -876,12 +876,23 @@ void system_sound_play(enum system_sound sound) params->amplitude * *params->setting); } } - + +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 button) +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 |