Fix locked context fallthrough

Enabling locked actions for all softlock targets accidentally
broke keylock on touchscreens because the generic touchscreen
keymap was missed. Trying to lookup CONTEXT_WPS|CONTEXT_LOCKED
returned the mapping for CONTEXT_STD because the locked version
wasn't explicitly handled.

But on almost all cases, a context's keymap does not change when
the screen is locked. It makes more sense to mask out the locked
flag and only check for it where needed.

Change-Id: I65cda2de82950d272d4394fd772286699e7c3779
This commit is contained in:
Aidan MacDonald 2023-03-17 23:43:39 +00:00
parent 0c29d1788e
commit a0a59ab610
17 changed files with 20 additions and 66 deletions

View file

@ -194,17 +194,14 @@ static const struct button_mapping button_context_bmark[] = {
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
const struct button_mapping* get_context_mapping(int context)
{
switch (context)
switch (context & ~CONTEXT_LOCKED)
{
case CONTEXT_STD | CONTEXT_LOCKED:
case CONTEXT_STD:
return button_context_standard;
case CONTEXT_WPS | CONTEXT_LOCKED:
case CONTEXT_WPS:
return button_context_wps;
case CONTEXT_MAINMENU | CONTEXT_LOCKED:
case CONTEXT_MAINMENU:
return button_context_mainmenu;