From eb2ea7f9ad4c4e2cce390f8fe73e17698fa9a906 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Thu, 12 Jan 2012 22:28:36 +1100 Subject: 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 --- apps/misc.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'apps/misc.c') diff --git a/apps/misc.c b/apps/misc.c index 3c55395..52e891e 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 -- cgit v1.1