mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
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:
parent
a92696d40d
commit
f688710707
6 changed files with 16 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
if (!(context & CONTEXT_RAWBUTTON))
|
||||
get_action_statuscode(&button);
|
||||
|
||||
/* Settings filters */
|
||||
if (
|
||||
#ifdef HAVE_HARDWARE_CLICK
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue