diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-08-16 00:32:45 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-08-16 00:32:45 +0000 |
commit | 1fdb5bff39158afedafbab369c61840f345251de (patch) | |
tree | 60b7b2ff42fc841773fc8ba17dc09b461f705711 /apps/action.c | |
parent | 013ab3dd3d49059a4896bce4498a48b91ade2bdc (diff) | |
download | rockbox-1fdb5bff39158afedafbab369c61840f345251de.tar.gz rockbox-1fdb5bff39158afedafbab369c61840f345251de.zip |
Changed the button action code to allow both single-fire and multi-fire events to be triggered with _REPEAT. Also simplifies the code. * Made the button mapping tables const to save RAM when running rockbox from flash ROM. * Repaired button mappings for Ondio. * Repaired some more button mappings for player. * Added missing TREE_STOP for iriver, and fixed WPS skipping for recorder.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10600 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/action.c')
-rw-r--r-- | apps/action.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/apps/action.c b/apps/action.c index fc5a8b88a9..02991c0127 100644 --- a/apps/action.c +++ b/apps/action.c | |||
@@ -33,7 +33,7 @@ bool allow_remote_actions = true; | |||
33 | * do_button_check is the worker function for get_default_action. | 33 | * do_button_check is the worker function for get_default_action. |
34 | * returns ACTION_UNKNOWN or the requested return value from the list. | 34 | * returns ACTION_UNKNOWN or the requested return value from the list. |
35 | */ | 35 | */ |
36 | inline int do_button_check(struct button_mapping *items, | 36 | inline int do_button_check(const struct button_mapping *items, |
37 | int button, int last_button, int *start) | 37 | int button, int last_button, int *start) |
38 | { | 38 | { |
39 | int i = 0; | 39 | int i = 0; |
@@ -41,24 +41,12 @@ inline int do_button_check(struct button_mapping *items, | |||
41 | if (items == NULL) | 41 | if (items == NULL) |
42 | return ACTION_UNKNOWN; | 42 | return ACTION_UNKNOWN; |
43 | 43 | ||
44 | /* Special case to make the keymaps smaller */ | ||
45 | if(button & BUTTON_REPEAT) | ||
46 | last_button &= ~BUTTON_REPEAT; | ||
47 | |||
48 | while (items[i].button_code != BUTTON_NONE) | 44 | while (items[i].button_code != BUTTON_NONE) |
49 | { | 45 | { |
50 | if (items[i].button_code == button) | 46 | if (items[i].button_code == button) |
51 | { | 47 | { |
52 | if (items[i].pre_button_code != BUTTON_NONE) | 48 | if ((items[i].pre_button_code == BUTTON_NONE) |
53 | { | 49 | || (items[i].pre_button_code == last_button)) |
54 | if ((items[i].pre_button_code == last_button) || | ||
55 | (items[i].button_code == last_button)) | ||
56 | { | ||
57 | ret = items[i].action_code; | ||
58 | break; | ||
59 | } | ||
60 | } | ||
61 | else | ||
62 | { | 50 | { |
63 | ret = items[i].action_code; | 51 | ret = items[i].action_code; |
64 | break; | 52 | break; |
@@ -70,7 +58,7 @@ inline int do_button_check(struct button_mapping *items, | |||
70 | return ret; | 58 | return ret; |
71 | } | 59 | } |
72 | 60 | ||
73 | inline int get_next_context(struct button_mapping *items, int i) | 61 | inline int get_next_context(const struct button_mapping *items, int i) |
74 | { | 62 | { |
75 | while (items[i].button_code != BUTTON_NONE) | 63 | while (items[i].button_code != BUTTON_NONE) |
76 | i++; | 64 | i++; |
@@ -95,9 +83,9 @@ inline int get_next_context(struct button_mapping *items, int i) | |||
95 | 83 | ||
96 | */ | 84 | */ |
97 | int get_action_worker(int context, int timeout, | 85 | int get_action_worker(int context, int timeout, |
98 | struct button_mapping* (*get_context_map)(int) ) | 86 | const struct button_mapping* (*get_context_map)(int) ) |
99 | { | 87 | { |
100 | struct button_mapping *items = NULL; | 88 | const struct button_mapping *items = NULL; |
101 | int button; | 89 | int button; |
102 | int i=0; | 90 | int i=0; |
103 | int ret = ACTION_UNKNOWN; | 91 | int ret = ACTION_UNKNOWN; |
@@ -183,7 +171,7 @@ int get_action(int context, int timeout) | |||
183 | } | 171 | } |
184 | 172 | ||
185 | int get_custom_action(int context,int timeout, | 173 | int get_custom_action(int context,int timeout, |
186 | struct button_mapping* (*get_context_map)(int)) | 174 | const struct button_mapping* (*get_context_map)(int)) |
187 | { | 175 | { |
188 | return get_action_worker(context,timeout,get_context_map); | 176 | return get_action_worker(context,timeout,get_context_map); |
189 | } | 177 | } |