diff options
Diffstat (limited to 'apps/action.c')
-rw-r--r-- | apps/action.c | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/apps/action.c b/apps/action.c index 07032f7ae7..15422f987b 100644 --- a/apps/action.c +++ b/apps/action.c | |||
@@ -735,8 +735,11 @@ static inline void do_softlock(action_last_t *last, action_cur_t *cur) | |||
735 | #else | 735 | #else |
736 | int action = cur->action; | 736 | int action = cur->action; |
737 | 737 | ||
738 | if (!last->screen_has_lock) | 738 | /* check to make sure we don't get stuck without a way to unlock - if locked, |
739 | { /* no need to check softlock return immediately */ | 739 | * we can still use unlock_combo to unlock */ |
740 | if (!last->screen_has_lock && !last->keys_locked) | ||
741 | { | ||
742 | /* no need to check softlock return immediately */ | ||
740 | return; | 743 | return; |
741 | } | 744 | } |
742 | 745 | ||
@@ -1180,7 +1183,7 @@ void set_selective_backlight_actions(bool selective, unsigned int mask, | |||
1180 | #ifndef HAS_BUTTON_HOLD | 1183 | #ifndef HAS_BUTTON_HOLD |
1181 | bool is_keys_locked(void) | 1184 | bool is_keys_locked(void) |
1182 | { | 1185 | { |
1183 | return (action_last.screen_has_lock && action_last.keys_locked); | 1186 | return (action_last.keys_locked); |
1184 | } | 1187 | } |
1185 | 1188 | ||
1186 | /* Enable selected actions to bypass a locked state */ | 1189 | /* Enable selected actions to bypass a locked state */ |
@@ -1196,7 +1199,57 @@ void set_selective_softlock_actions(bool selective, unsigned int mask) | |||
1196 | action_last.softlock_mask = SEL_ACTION_NONE; | 1199 | action_last.softlock_mask = SEL_ACTION_NONE; |
1197 | } | 1200 | } |
1198 | } | 1201 | } |
1202 | |||
1203 | |||
1204 | void action_autosoftlock_init(void) | ||
1205 | { | ||
1206 | action_cur_t cur; | ||
1207 | int i = 0; | ||
1208 | |||
1209 | if (action_last.unlock_combo == BUTTON_NONE) | ||
1210 | { | ||
1211 | /* search CONTEXT_WPS, should be here */ | ||
1212 | cur.items = get_context_mapping(CONTEXT_WPS); | ||
1213 | while (cur.items[i].button_code != BUTTON_NONE) | ||
1214 | { | ||
1215 | if (cur.items[i].action_code == ACTION_STD_KEYLOCK) | ||
1216 | { | ||
1217 | action_last.unlock_combo = cur.items[i].button_code; | ||
1218 | break; | ||
1219 | } | ||
1220 | i = i + 1; | ||
1221 | } | ||
1222 | |||
1223 | /* not there... let's try std | ||
1224 | * I doubt any targets will need this, but... */ | ||
1225 | if (action_last.unlock_combo == BUTTON_NONE) | ||
1226 | { | ||
1227 | i = 0; | ||
1228 | cur.items = get_context_mapping(CONTEXT_STD); | ||
1229 | while (cur.items[i].button_code != BUTTON_NONE) | ||
1230 | { | ||
1231 | if (cur.items[i].action_code == ACTION_STD_KEYLOCK) | ||
1232 | { | ||
1233 | action_last.unlock_combo = cur.items[i].button_code; | ||
1234 | break; | ||
1235 | } | ||
1236 | i = i + 1; | ||
1237 | } | ||
1238 | } | ||
1239 | } | ||
1240 | |||
1241 | /* if we have autolock and alwaysautolock, go ahead and arm it */ | ||
1242 | if (has_flag(action_last.softlock_mask, SEL_ACTION_AUTOLOCK) && | ||
1243 | has_flag(action_last.softlock_mask, SEL_ACTION_ALWAYSAUTOLOCK) && | ||
1244 | (action_last.unlock_combo != BUTTON_NONE)) | ||
1245 | { | ||
1246 | action_last.softlock_mask = action_last.softlock_mask | SEL_ACTION_ALOCK_OK; | ||
1247 | } | ||
1248 | |||
1249 | return; | ||
1250 | } | ||
1199 | #endif /* !HAS_BUTTON_HOLD */ | 1251 | #endif /* !HAS_BUTTON_HOLD */ |
1252 | |||
1200 | /* | 1253 | /* |
1201 | ******************************************************************************* | 1254 | ******************************************************************************* |
1202 | * END EXPORTED ACTION FUNCTIONS *********************************************** | 1255 | * END EXPORTED ACTION FUNCTIONS *********************************************** |