From 51e61dc205b72ba8ca6c32a141ba7ef91f682595 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 13 Aug 2017 11:23:51 -0700 Subject: [PATCH] Add a helper function for pressing modifier keys that we receive as flags on a key we're asked to press --- src/kaleidoscope/hid.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/kaleidoscope/hid.cpp b/src/kaleidoscope/hid.cpp index 90fac5aa..d97b1462 100644 --- a/src/kaleidoscope/hid.cpp +++ b/src/kaleidoscope/hid.cpp @@ -12,21 +12,25 @@ void pressRawKey(Key mappedKey) { } +void _pressModifierKey(Key mappedKey) { + pressRawKey(mappedKey); +} + void pressKey(Key mappedKey) { if (mappedKey.flags & SHIFT_HELD) { - pressRawKey(Key_LeftShift); + _pressModifierKey(Key_LeftShift); } if (mappedKey.flags & CTRL_HELD) { - pressRawKey(Key_LeftControl); + _pressModifierKey(Key_LeftControl); } if (mappedKey.flags & LALT_HELD) { - pressRawKey(Key_LeftAlt); + _pressModifierKey(Key_LeftAlt); } if (mappedKey.flags & RALT_HELD) { - pressRawKey(Key_RightAlt); + _pressModifierKey(Key_RightAlt); } if (mappedKey.flags & GUI_HELD) { - pressRawKey(Key_LeftGui); + _pressModifierKey(Key_LeftGui); } pressRawKey(mappedKey);