Add Macros.isMacroKey() function

This just isolates the test for a Macros plugin key to its own function.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/966/head
Michael Richters 4 years ago
parent d673585224
commit ef126a267e
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -243,8 +243,14 @@ const macro_t *Macros_::type(const char *string) {
return MACRO_NONE;
}
bool Macros_::isMacroKey(Key key) {
if (key.getFlags() == (SYNTHETIC | IS_MACRO))
return true;
return false;
}
EventHandlerResult Macros_::onKeyswitchEvent(Key &mappedKey, KeyAddr key_addr, uint8_t keyState) {
if (mappedKey.getFlags() != (SYNTHETIC | IS_MACRO))
if (! isMacroKey(mappedKey))
return EventHandlerResult::OK;
addActiveMacroKey(mappedKey.getKeyCode(), key_addr.toInt(), keyState);

@ -80,6 +80,7 @@ class Macros_ : public kaleidoscope::Plugin {
private:
Key lookupAsciiCode(uint8_t ascii_code);
bool isMacroKey(Key key);
};
}

Loading…
Cancel
Save