From 322c2fa5894f602038e21f70f474af84ded29842 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 11 Nov 2016 18:18:40 -0800 Subject: [PATCH] Split out the left and right alt keys, to make it easier to emulate altgr. This may or may not actually be useful. --- key_defs.h | 11 ++++++----- key_events.cpp | 5 ++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/key_defs.h b/key_defs.h index 2ca01f91..f4659dcd 100644 --- a/key_defs.h +++ b/key_defs.h @@ -15,11 +15,12 @@ typedef union { #define KEY_FLAGS B00000000 #define CTRL_HELD B00000001 -#define ALT_HELD B00000010 -#define SHIFT_HELD B00000100 -#define GUI_HELD B00001000 -#define SWITCH_TO_KEYMAP B00010000 -#define MOMENTARY B00100000 +#define LALT_HELD B00000010 +#define RALT_HELD B00000010 +#define SHIFT_HELD B00001000 +#define GUI_HELD B00010000 +#define SWITCH_TO_KEYMAP B00100000 +#define MOMENTARY B01000000 #define SYNTHETIC_KEY B10000000 // we assert that synthetic keys can never have keys held, so we reuse the _HELD bits diff --git a/key_events.cpp b/key_events.cpp index 7a817617..61fee933 100644 --- a/key_events.cpp +++ b/key_events.cpp @@ -93,7 +93,10 @@ void press_key(Key mappedKey) { if (mappedKey.flags & CTRL_HELD) { Keyboard.press(Key_LCtrl.rawKey); } - if (mappedKey.flags & ALT_HELD) { + if (mappedKey.flags & LALT_HELD) { + Keyboard.press(Key_LAlt.rawKey); + } + if (mappedKey.flags & RALT_HELD) { Keyboard.press(Key_RAlt.rawKey); } if (mappedKey.flags & GUI_HELD) {