From 561eb7a53d5372913797fb96fe92d82f5865fb55 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 22 Jan 2017 20:11:59 +0100 Subject: [PATCH] Fix the isModifier helper macro The macro needs to check `.keyCode` and `.flags` separately, due to byte ordering. If it does not, it will easily catch other things. Signed-off-by: Gergely Nagy --- src/Akela/OneShot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Akela/OneShot.cpp b/src/Akela/OneShot.cpp index 874fde2c..dc6adf5c 100644 --- a/src/Akela/OneShot.cpp +++ b/src/Akela/OneShot.cpp @@ -35,7 +35,7 @@ namespace Akela { // --- helper macros ------ #define isOS(key) (key.raw >= OS_FIRST && key.raw <= OS_LAST) -#define isModifier(key) (key.raw >= Key_LCtrl.raw && key.raw <= Key_RGUI.raw) +#define isModifier(key) (key.keyCode >= Key_LCtrl.raw && key.keyCode <= Key_RGUI.raw && key.flags == 0) #define isLayerKey(key) (key.flags & (KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) && key.keyCode >= MOMENTARY_OFFSET && key.keyCode <= MOMENTARY_OFFSET + 23) #define isOneShot(idx) (bitRead (State, idx))