When checking for normal layer keys, make sure the RESERVED bit isn't set

If the `RESERVED` bit is set, that means the key is outside of the control of
the core firmware, and as such, can't be a normal layer key. As it happens,
`OSM(LeftControl)` (and other OSM keys) triggered this branch of code, and
resulted in one-shot modifiers getting highlighted too.

Thanks to @ToyKeeper for reporting the problem, and providing reproduction
steps.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 7 years ago
parent a0dad6bf0e
commit f25480730e

@ -51,7 +51,8 @@ bool ActiveModColorEffect::isLayerKeyActive(Key key) {
if (key.raw >= ranges::OSL_FIRST && key.raw <= ranges::OSL_LAST) {
layer = key.raw - ranges::OSL_FIRST;
} else if (key.flags & (SYNTHETIC | SWITCH_TO_KEYMAP)) {
} else if ((key.flags & (SYNTHETIC | SWITCH_TO_KEYMAP)) &&
!(key.flags & RESERVED)) {
layer = key.keyCode;
if (layer >= MOMENTARY_OFFSET)
layer -= MOMENTARY_OFFSET;

Loading…
Cancel
Save