summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-03-03 07:10:56 -0500
committerMichael Sevakis <jethead71@rockbox.org>2012-03-03 07:10:56 -0500
commitf688710707f3af56a5949b8ae3957c9408b25392 (patch)
tree5e0a15f00d66337123406c09c207f531a4c18eca
parenta92696d40d3515d4391ffba043894ebbad80cab6 (diff)
downloadrockbox-f688710707f3af56a5949b8ae3957c9408b25392.tar.gz
rockbox-f688710707f3af56a5949b8ae3957c9408b25392.zip
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
-rw-r--r--apps/action.c2
-rw-r--r--apps/action.h5
-rw-r--r--apps/misc.c8
-rw-r--r--apps/misc.h2
-rw-r--r--apps/plugin.h6
-rw-r--r--apps/plugins/mpegplayer/mpeg_misc.c2
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,
368 368
369#if CONFIG_CODEC == SWCODEC 369#if CONFIG_CODEC == SWCODEC
370 /* Produce keyclick */ 370 /* Produce keyclick */
371 keyclick_click(ret); 371 keyclick_click(0, ret);
372#endif 372#endif
373 373
374 return ret; 374 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 @@
42#define ALLOW_SOFTLOCK 0 42#define ALLOW_SOFTLOCK 0
43#endif 43#endif
44 44
45#define CONTEXT_RAWBUTTON 0x04000000 /* For passing raw button code to
46 functions that normally take
47 action codes
48 (ie. keyclick_click) */
49
45enum { 50enum {
46 CONTEXT_STD = 0, 51 CONTEXT_STD = 0,
47 /* These CONTEXT_ values were here before me, 52 /* 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)
887} 887}
888 888
889/* Produce keyclick based upon button and global settings */ 889/* Produce keyclick based upon button and global settings */
890void keyclick_click(int action) 890void keyclick_click(int context, int action)
891{ 891{
892 int button; 892 int button = action;
893 static long last_button = BUTTON_NONE; 893 static long last_button = BUTTON_NONE;
894 bool do_beep = false; 894 bool do_beep = false;
895 895
896 get_action_statuscode(&button); 896 if (!(context & CONTEXT_RAWBUTTON))
897 get_action_statuscode(&button);
898
897 /* Settings filters */ 899 /* Settings filters */
898 if ( 900 if (
899#ifdef HAVE_HARDWARE_CLICK 901#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);
148typedef bool (*keyclick_callback)(int action, void* data); 148typedef bool (*keyclick_callback)(int action, void* data);
149void keyclick_set_callback(keyclick_callback cb, void* data); 149void keyclick_set_callback(keyclick_callback cb, void* data);
150/* Produce keyclick based upon button and global settings */ 150/* Produce keyclick based upon button and global settings */
151void keyclick_click(int action); 151void keyclick_click(int context, int action);
152#endif /* CONFIG_CODEC == SWCODEC */ 152#endif /* CONFIG_CODEC == SWCODEC */
153 153
154void push_current_activity(enum current_activity screen); 154void 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);
153#define PLUGIN_MAGIC 0x526F634B /* RocK */ 153#define PLUGIN_MAGIC 0x526F634B /* RocK */
154 154
155/* increase this every time the api struct changes */ 155/* increase this every time the api struct changes */
156#define PLUGIN_API_VERSION 217 156#define PLUGIN_API_VERSION 218
157 157
158/* update this to latest version if a change to the api struct breaks 158/* update this to latest version if a change to the api struct breaks
159 backwards compatibility (and please take the opportunity to sort in any 159 backwards compatibility (and please take the opportunity to sort in any
160 new function which are "waiting" at the end of the function table) */ 160 new function which are "waiting" at the end of the function table) */
161#define PLUGIN_MIN_API_VERSION 217 161#define PLUGIN_MIN_API_VERSION 218
162 162
163/* plugin return codes */ 163/* plugin return codes */
164/* internal returns start at 0x100 to make exit(1..255) work */ 164/* internal returns start at 0x100 to make exit(1..255) work */
@@ -705,7 +705,7 @@ struct plugin_api {
705 size_t (*mixer_channel_get_bytes_waiting)(enum pcm_mixer_channel channel); 705 size_t (*mixer_channel_get_bytes_waiting)(enum pcm_mixer_channel channel);
706 706
707 void (*system_sound_play)(enum system_sound sound); 707 void (*system_sound_play)(enum system_sound sound);
708 void (*keyclick_click)(int button); 708 void (*keyclick_click)(int context, int action);
709#endif /* CONFIG_CODEC == SWCODC */ 709#endif /* CONFIG_CODEC == SWCODC */
710 710
711 /* playback control */ 711 /* 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)
216 rb->button_get_w_tmo(timeout); 216 rb->button_get_w_tmo(timeout);
217 217
218 /* Produce keyclick */ 218 /* Produce keyclick */
219 rb->keyclick_click(button); 219 rb->keyclick_click(CONTEXT_RAWBUTTON, button);
220 220
221 return mpeg_sysevent_callback(button, NULL); 221 return mpeg_sysevent_callback(button, NULL);
222} 222}