From 3db2779b23ef9a4e9a4e8a31fc26aed460b8e8b5 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Wed, 2 Dec 2020 12:57:03 -0600 Subject: [PATCH] Use new builtin `Key` variant test functions in Qukeys Signed-off-by: Michael Richters --- src/kaleidoscope/plugin/Qukeys.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/kaleidoscope/plugin/Qukeys.cpp b/src/kaleidoscope/plugin/Qukeys.cpp index 67643acc..58b1d1e4 100644 --- a/src/kaleidoscope/plugin/Qukeys.cpp +++ b/src/kaleidoscope/plugin/Qukeys.cpp @@ -418,24 +418,11 @@ bool Qukeys::isKeyAddrInQueueBeforeIndex(KeyAddr k, uint8_t index) const { // ----------------------------------------------------------------------------- -// This function could get lifted into Kaleidoscope proper, since it might be -// more generally useful. It's here to provide the test for a SpaceCadet-type -// qukey, which is any Qukey that has a modifier (including layer shifts) as its -// primary value. +// This function is here to provide the test for a SpaceCadet-type qukey, which +// is any Qukey that has a modifier (including layer shifts) as its primary +// value. bool isModifierKey(Key key) { - // If it's a plain keyboard key, return true if its base keycode is a - // modifier, otherwise return false: - if ((key.getFlags() & (SYNTHETIC | RESERVED)) == 0) { - return (key.getKeyCode() >= HID_KEYBOARD_FIRST_MODIFIER && - key.getKeyCode() <= HID_KEYBOARD_LAST_MODIFIER); - } - // If it's a layer shift key, return true: - if (key.getFlags() == (SYNTHETIC | SWITCH_TO_KEYMAP) && - key.getKeyCode() >= LAYER_SHIFT_OFFSET) { - return true; - } - // In all other cases, return false: - return false; + return (key.isKeyboardModifier() || key.isLayerShift()); } } // namespace plugin {