From 0f91fcda82ca9c60f11fbb94190d5903c4a3c442 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 23 Nov 2016 12:59:45 +0100 Subject: [PATCH] Use the new INJECTED flag in the default handlers Instead of abusing `Key_NoKey`, use the new `INJECTED` flag in `handle_key_event` and `handle_key_event_default` to check if the event is an original, or an injected one. Signed-off-by: Gergely Nagy --- src/key_events.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/key_events.cpp b/src/key_events.cpp index 8f2cfe0d..8e8b0ff1 100644 --- a/src/key_events.cpp +++ b/src/key_events.cpp @@ -30,7 +30,7 @@ Key lookup_key(byte keymap, byte row, byte col) { } void handle_key_event(Key mappedKey, byte row, byte col, uint8_t currentState, uint8_t previousState) { - if (mappedKey.raw == Key_NoKey.raw) { + if (!(currentState & INJECTED)) { mappedKey = lookup_key(temporary_keymap, row, col); } for (byte i = 0; eventHandlers[i] != NULL && i < HOOK_MAX; i++) { @@ -45,7 +45,7 @@ bool handle_key_event_default(Key mappedKey, byte row, byte col, uint8_t current // for every newly released button, figure out what logical key it is and send a key up event Key baseKey = Key_NoKey; - if (mappedKey.raw == Key_NoKey.raw) { + if (!(currentState & INJECTED)) { baseKey = lookup_key(primary_keymap, row, col); }