summaryrefslogtreecommitdiff
path: root/apps/action.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/action.c')
-rw-r--r--apps/action.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/apps/action.c b/apps/action.c
index 30eccb8d81..7667e4dd12 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -31,6 +31,8 @@
31 31
32static bool ignore_until_release = false; 32static bool ignore_until_release = false;
33static int last_button = BUTTON_NONE; 33static int last_button = BUTTON_NONE;
34static int last_action = ACTION_NONE;
35static bool repeated = false;
34 36
35/* software keylock stuff */ 37/* software keylock stuff */
36#ifndef HAS_BUTTON_HOLD 38#ifndef HAS_BUTTON_HOLD
@@ -107,7 +109,6 @@ static int get_action_worker(int context, int timeout,
107 else 109 else
108 button = button_get_w_tmo(timeout); 110 button = button_get_w_tmo(timeout);
109 111
110
111 if (button == BUTTON_NONE || button&SYS_EVENT) 112 if (button == BUTTON_NONE || button&SYS_EVENT)
112 { 113 {
113 return button; 114 return button;
@@ -185,6 +186,11 @@ static int get_action_worker(int context, int timeout,
185 return ACTION_REDRAW; 186 return ACTION_REDRAW;
186 } 187 }
187#endif 188#endif
189 if (ret == last_action)
190 repeated = true;
191 else
192 repeated = false;
193
188 last_button = button; 194 last_button = button;
189 return ret; 195 return ret;
190} 196}
@@ -224,3 +230,18 @@ bool is_keys_locked(void)
224 return (screen_has_lock && (keys_locked == true)); 230 return (screen_has_lock && (keys_locked == true));
225} 231}
226#endif 232#endif
233
234int get_action_statuscode(int *button)
235{
236 int ret = 0;
237 if (button)
238 *button = last_button;
239
240 if (last_button&BUTTON_REMOTE)
241 ret |= ACTION_REMOTE;
242 if (repeated)
243 ret |= ACTION_REPEAT;
244 if (ignore_until_release)
245 ret |= ACTION_IGNORING;
246 return ret;
247}