summaryrefslogtreecommitdiff
path: root/apps/action.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/action.c')
-rw-r--r--apps/action.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/apps/action.c b/apps/action.c
index d9f04a8c89..826f376dcd 100644
--- a/apps/action.c
+++ b/apps/action.c
@@ -29,8 +29,8 @@
29#include "debug.h" 29#include "debug.h"
30#include "splash.h" 30#include "splash.h"
31 31
32static bool ignore_until_release = false; 32static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to
33static int last_button = BUTTON_NONE; 33 work on startup */
34static int last_action = ACTION_NONE; 34static int last_action = ACTION_NONE;
35static bool repeated = false; 35static bool repeated = false;
36 36
@@ -104,6 +104,7 @@ static int get_action_worker(int context, int timeout,
104 int button; 104 int button;
105 int i=0; 105 int i=0;
106 int ret = ACTION_UNKNOWN; 106 int ret = ACTION_UNKNOWN;
107 static int last_context = CONTEXT_STD;
107 108
108 if (timeout == TIMEOUT_NOBLOCK) 109 if (timeout == TIMEOUT_NOBLOCK)
109 button = button_get(false); 110 button = button_get(false);
@@ -117,14 +118,18 @@ static int get_action_worker(int context, int timeout,
117 return button; 118 return button;
118 } 119 }
119 120
120 if (ignore_until_release == true) 121 if ((context != last_context) && ((last_button&BUTTON_REL) == 0))
121 { 122 {
122 if (button&BUTTON_REL) 123 if (button&BUTTON_REL)
123 { 124 {
124 ignore_until_release = false; 125 last_button = button;
126 last_action = ACTION_NONE;
125 } 127 }
128 /* eat all buttons until the previous button was |BUTTON_REL
129 (also eat the |BUTTON_REL button) */
126 return ACTION_NONE; /* "safest" return value */ 130 return ACTION_NONE; /* "safest" return value */
127 } 131 }
132 last_context = context;
128 133
129#ifndef HAS_BUTTON_HOLD 134#ifndef HAS_BUTTON_HOLD
130 screen_has_lock = ((context&ALLOW_SOFTLOCK)==ALLOW_SOFTLOCK); 135 screen_has_lock = ((context&ALLOW_SOFTLOCK)==ALLOW_SOFTLOCK);
@@ -182,7 +187,6 @@ static int get_action_worker(int context, int timeout,
182 { 187 {
183 unlock_combo = button; 188 unlock_combo = button;
184 keys_locked = true; 189 keys_locked = true;
185 action_signalscreenchange();
186 gui_syncsplash(HZ/2, str(LANG_KEYLOCK_ON_PLAYER)); 190 gui_syncsplash(HZ/2, str(LANG_KEYLOCK_ON_PLAYER));
187 191
188 button_clear_queue(); 192 button_clear_queue();
@@ -214,22 +218,11 @@ int get_custom_action(int context,int timeout,
214 218
215bool action_userabort(int timeout) 219bool action_userabort(int timeout)
216{ 220{
217 action_signalscreenchange();
218 int action = get_action_worker(CONTEXT_STD,timeout,NULL); 221 int action = get_action_worker(CONTEXT_STD,timeout,NULL);
219 bool ret = (action == ACTION_STD_CANCEL); 222 bool ret = (action == ACTION_STD_CANCEL);
220 action_signalscreenchange();
221 return ret; 223 return ret;
222} 224}
223 225
224void action_signalscreenchange(void)
225{
226 if ((last_button != BUTTON_NONE) &&
227 !(last_button&BUTTON_REL))
228 {
229 ignore_until_release = true;
230 }
231 last_button = BUTTON_NONE;
232}
233#ifndef HAS_BUTTON_HOLD 226#ifndef HAS_BUTTON_HOLD
234bool is_keys_locked(void) 227bool is_keys_locked(void)
235{ 228{
@@ -247,7 +240,5 @@ int get_action_statuscode(int *button)
247 ret |= ACTION_REMOTE; 240 ret |= ACTION_REMOTE;
248 if (repeated) 241 if (repeated)
249 ret |= ACTION_REPEAT; 242 ret |= ACTION_REPEAT;
250 if (ignore_until_release)
251 ret |= ACTION_IGNORING;
252 return ret; 243 return ret;
253} 244}