From 453e30038fd2b79c7d1998463d1b77adf92ae547 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Thu, 10 Aug 2017 08:50:43 +0200 Subject: [PATCH] isLayerKeyActive: Check for flag equality, not just two bits set To find layer keys and layer keys only, we need to make sure that `key.flags` has only these two bits set, and none of the others. Otherwise it may light up keys as if they were layer keys, while they aren't, because they happen to have `SYNTHETIC` and `SWITCH_TO_KEYMAP` set, `RESERVED` unset, but have other flags that make the event handler loop treat them properly. Mouse keys are one such thing. Thanks to @ToyKeeper for reporting the issue! Signed-off-by: Gergely Nagy --- src/Kaleidoscope/LED-ActiveModColor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Kaleidoscope/LED-ActiveModColor.cpp b/src/Kaleidoscope/LED-ActiveModColor.cpp index 9bf68d11..9e52352e 100644 --- a/src/Kaleidoscope/LED-ActiveModColor.cpp +++ b/src/Kaleidoscope/LED-ActiveModColor.cpp @@ -51,8 +51,7 @@ 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)) && - !(key.flags & RESERVED)) { + } else if (key.flags == (SYNTHETIC | SWITCH_TO_KEYMAP)) { layer = key.keyCode; if (layer >= MOMENTARY_OFFSET) layer -= MOMENTARY_OFFSET;