Skip to content

Commit

Permalink
Add option to use weak mods in key overrides, fix when NO_ACTION_ONES…
Browse files Browse the repository at this point in the history
…HOT is defined
  • Loading branch information
JonasGessner committed Jan 9, 2021
1 parent 6c1e113 commit edcaa3d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions quantum/key_override.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,17 @@ bool process_key_override(const uint16_t keycode, const keyrecord_t *const recor
return true;
}

// Locked one shot mods are added to get_mods() (why??) while oneshot mods are in get_oneshot_mods().
uint8_t effective_mods = get_mods() | get_oneshot_mods();

uint8_t effective_mods = get_mods();

#ifdef KEY_OVERRIDE_INCLUDE_WEAK_MODS
effective_mods |= get_weak_mods();
#endif

#ifndef NO_ACTION_ONESHOT
// Locked one shot mods are added to get_mods(), I think (why??) while oneshot mods are in get_oneshot_mods(). Still OR with get_locked_oneshot_mods because that's where those mods _should_ be saved.
effective_mods |= get_oneshot_locked_mods() | get_oneshot_mods();
#endif

if (is_mod) {
// The mods returned from get_mods() will be updated with this new event _after_ this code runs. Hence we manually update the effective mods here to really know the effective mods.
if (key_down) {
Expand Down

0 comments on commit edcaa3d

Please sign in to comment.