summaryrefslogtreecommitdiff
path: root/apps/action.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/action.c')
-rw-r--r--apps/action.c26
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 */
36inline int do_button_check(struct button_mapping *items, 36inline 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
73inline int get_next_context(struct button_mapping *items, int i) 61inline 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 */
97int get_action_worker(int context, int timeout, 85int 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
185int get_custom_action(int context,int timeout, 173int 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}