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
This commit is contained in:
Michael Sevakis 2012-03-03 07:10:56 -05:00
parent a92696d40d
commit f688710707
6 changed files with 16 additions and 9 deletions

View file

@ -368,7 +368,7 @@ static int get_action_worker(int context, int timeout,
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
/* Produce keyclick */ /* Produce keyclick */
keyclick_click(ret); keyclick_click(0, ret);
#endif #endif
return ret; return ret;

View file

@ -42,6 +42,11 @@
#define ALLOW_SOFTLOCK 0 #define ALLOW_SOFTLOCK 0
#endif #endif
#define CONTEXT_RAWBUTTON 0x04000000 /* For passing raw button code to
functions that normally take
action codes
(ie. keyclick_click) */
enum { enum {
CONTEXT_STD = 0, CONTEXT_STD = 0,
/* These CONTEXT_ values were here before me, /* These CONTEXT_ values were here before me,

View file

@ -887,13 +887,15 @@ void keyclick_set_callback(keyclick_callback cb, void* data)
} }
/* Produce keyclick based upon button and global settings */ /* 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; static long last_button = BUTTON_NONE;
bool do_beep = false; bool do_beep = false;
get_action_statuscode(&button); if (!(context & CONTEXT_RAWBUTTON))
get_action_statuscode(&button);
/* Settings filters */ /* Settings filters */
if ( if (
#ifdef HAVE_HARDWARE_CLICK #ifdef HAVE_HARDWARE_CLICK

View file

@ -148,7 +148,7 @@ void system_sound_play(enum system_sound sound);
typedef bool (*keyclick_callback)(int action, void* data); typedef bool (*keyclick_callback)(int action, void* data);
void keyclick_set_callback(keyclick_callback cb, void* data); void keyclick_set_callback(keyclick_callback cb, void* data);
/* Produce keyclick based upon button and global settings */ /* Produce keyclick based upon button and global settings */
void keyclick_click(int action); void keyclick_click(int context, int action);
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
void push_current_activity(enum current_activity screen); void push_current_activity(enum current_activity screen);

View file

@ -153,12 +153,12 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* 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 /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */ 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 */ /* plugin return codes */
/* internal returns start at 0x100 to make exit(1..255) work */ /* 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); size_t (*mixer_channel_get_bytes_waiting)(enum pcm_mixer_channel channel);
void (*system_sound_play)(enum system_sound sound); void (*system_sound_play)(enum system_sound sound);
void (*keyclick_click)(int button); void (*keyclick_click)(int context, int action);
#endif /* CONFIG_CODEC == SWCODC */ #endif /* CONFIG_CODEC == SWCODC */
/* playback control */ /* playback control */

View file

@ -216,7 +216,7 @@ int mpeg_button_get(int timeout)
rb->button_get_w_tmo(timeout); rb->button_get_w_tmo(timeout);
/* Produce keyclick */ /* Produce keyclick */
rb->keyclick_click(button); rb->keyclick_click(CONTEXT_RAWBUTTON, button);
return mpeg_sysevent_callback(button, NULL); return mpeg_sysevent_callback(button, NULL);
} }