From f688710707f3af56a5949b8ae3957c9408b25392 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 3 Mar 2012 07:10:56 -0500 Subject: Change keyclick_click so that it may accept raw buttons or actions. Adds a new context, CONTEXT_RAWBUTTON, that I hope is out of the way of everything. Unfortunately have to increment min plugin API version for the second time today to accomodate additional parameter. Change-Id: Iaa46b926e57cf377fd4906f2d42bb98e87215033 --- apps/action.c | 2 +- apps/action.h | 5 +++++ apps/misc.c | 8 +++++--- apps/misc.h | 2 +- apps/plugin.h | 6 +++--- apps/plugins/mpegplayer/mpeg_misc.c | 2 +- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/apps/action.c b/apps/action.c index 3747a7521e..69089d1d8c 100644 --- a/apps/action.c +++ b/apps/action.c @@ -368,7 +368,7 @@ static int get_action_worker(int context, int timeout, #if CONFIG_CODEC == SWCODEC /* Produce keyclick */ - keyclick_click(ret); + keyclick_click(0, ret); #endif return ret; diff --git a/apps/action.h b/apps/action.h index e46e4a64b2..1bffed3b75 100644 --- a/apps/action.h +++ b/apps/action.h @@ -42,6 +42,11 @@ #define ALLOW_SOFTLOCK 0 #endif +#define CONTEXT_RAWBUTTON 0x04000000 /* For passing raw button code to + functions that normally take + action codes + (ie. keyclick_click) */ + enum { CONTEXT_STD = 0, /* These CONTEXT_ values were here before me, diff --git a/apps/misc.c b/apps/misc.c index 3fe330b8fe..78ee154c56 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -887,13 +887,15 @@ void keyclick_set_callback(keyclick_callback cb, void* data) } /* Produce keyclick based upon button and global settings */ -void keyclick_click(int action) +void keyclick_click(int context, int action) { - int button; + int button = action; static long last_button = BUTTON_NONE; bool do_beep = false; - get_action_statuscode(&button); + if (!(context & CONTEXT_RAWBUTTON)) + get_action_statuscode(&button); + /* Settings filters */ if ( #ifdef HAVE_HARDWARE_CLICK diff --git a/apps/misc.h b/apps/misc.h index a3d9ffd582..4ae7c19a32 100644 --- a/apps/misc.h +++ b/apps/misc.h @@ -148,7 +148,7 @@ void system_sound_play(enum system_sound sound); typedef bool (*keyclick_callback)(int action, void* data); void keyclick_set_callback(keyclick_callback cb, void* data); /* Produce keyclick based upon button and global settings */ -void keyclick_click(int action); +void keyclick_click(int context, int action); #endif /* CONFIG_CODEC == SWCODEC */ void push_current_activity(enum current_activity screen); diff --git a/apps/plugin.h b/apps/plugin.h index e07ec92c08..bddf23b5d2 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -153,12 +153,12 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 217 +#define PLUGIN_API_VERSION 218 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 217 +#define PLUGIN_MIN_API_VERSION 218 /* plugin return codes */ /* internal returns start at 0x100 to make exit(1..255) work */ @@ -705,7 +705,7 @@ struct plugin_api { size_t (*mixer_channel_get_bytes_waiting)(enum pcm_mixer_channel channel); void (*system_sound_play)(enum system_sound sound); - void (*keyclick_click)(int button); + void (*keyclick_click)(int context, int action); #endif /* CONFIG_CODEC == SWCODC */ /* playback control */ diff --git a/apps/plugins/mpegplayer/mpeg_misc.c b/apps/plugins/mpegplayer/mpeg_misc.c index 895fbe04a9..cbaca70646 100644 --- a/apps/plugins/mpegplayer/mpeg_misc.c +++ b/apps/plugins/mpegplayer/mpeg_misc.c @@ -216,7 +216,7 @@ int mpeg_button_get(int timeout) rb->button_get_w_tmo(timeout); /* Produce keyclick */ - rb->keyclick_click(button); + rb->keyclick_click(CONTEXT_RAWBUTTON, button); return mpeg_sysevent_callback(button, NULL); } -- cgit v1.2.3