Add a helper function for pressing modifier keys that we receive as

flags on a key we're asked to press
pull/179/head
Jesse Vincent 7 years ago
parent 14ae21267b
commit 51e61dc205
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -12,21 +12,25 @@ void pressRawKey(Key mappedKey) {
} }
void _pressModifierKey(Key mappedKey) {
pressRawKey(mappedKey);
}
void pressKey(Key mappedKey) { void pressKey(Key mappedKey) {
if (mappedKey.flags & SHIFT_HELD) { if (mappedKey.flags & SHIFT_HELD) {
pressRawKey(Key_LeftShift); _pressModifierKey(Key_LeftShift);
} }
if (mappedKey.flags & CTRL_HELD) { if (mappedKey.flags & CTRL_HELD) {
pressRawKey(Key_LeftControl); _pressModifierKey(Key_LeftControl);
} }
if (mappedKey.flags & LALT_HELD) { if (mappedKey.flags & LALT_HELD) {
pressRawKey(Key_LeftAlt); _pressModifierKey(Key_LeftAlt);
} }
if (mappedKey.flags & RALT_HELD) { if (mappedKey.flags & RALT_HELD) {
pressRawKey(Key_RightAlt); _pressModifierKey(Key_RightAlt);
} }
if (mappedKey.flags & GUI_HELD) { if (mappedKey.flags & GUI_HELD) {
pressRawKey(Key_LeftGui); _pressModifierKey(Key_LeftGui);
} }
pressRawKey(mappedKey); pressRawKey(mappedKey);

Loading…
Cancel
Save