From a2bac25a6355d1ac59df34717a28c3c03728c885 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sun, 16 May 2021 16:42:01 +0100 Subject: [PATCH] Allow alternative keymap when keys are locked To enable support targets must define HAVE_LOCKED_ACTIONS and then handle the CONTEXT_LOCKED flag from get_context_mapping(). Change-Id: I92703b534e4a45b4ebbf9bf98af42df9b8ac3b1a --- apps/action.c | 7 +++++++ apps/action.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/apps/action.c b/apps/action.c index 34897b938c..74f0a3d7df 100644 --- a/apps/action.c +++ b/apps/action.c @@ -586,6 +586,13 @@ static inline void action_code_lookup(action_last_t *last, action_cur_t *cur) cur->is_prebutton = false; +#ifdef HAVE_LOCKED_ACTIONS + /* This only applies to the first context, to allow locked contexts to + * specify a fall through to their non-locked version */ + if (is_keys_locked()) + context |= CONTEXT_LOCKED; +#endif + for(;;) { /* logf("context = %x",context); */ diff --git a/apps/action.h b/apps/action.h index e4ad29504b..711ec58f71 100644 --- a/apps/action.h +++ b/apps/action.h @@ -32,6 +32,9 @@ #define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */ #define CONTEXT_CUSTOM2 0x20000000 /* as above */ #define CONTEXT_PLUGIN 0x10000000 /* for plugins using get_custom_action */ +#ifdef HAVE_LOCKED_ACTIONS +#define CONTEXT_LOCKED 0x04000000 /* flag to use alternate keymap when screen is locked */ +#endif #define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE } #define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE }