Added EPHEMERAL keyswitch state flag

An `EPHEMERAL` keyswitch event is one that gets ignored by updates to
`live_composite_keymap_[]`, and thus doesn't change the keymap at all. This is useful for
a plugin that needs to retain its own key type in the keymap in order to do something
particular when it toggles off, but needs to inject an event with a different `Key` value,
with real key coordinates.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/502/head
Michael Richters 6 years ago
parent dc7c1e9c1f
commit 66f79c7cbd

@ -82,7 +82,7 @@ void handleKeyswitchEvent(Key mappedKey, byte row, byte col, uint8_t keyState) {
/* If a key had an on event, we update the live composite keymap. See /* If a key had an on event, we update the live composite keymap. See
* layers.h for an explanation about the different caches we have. */ * layers.h for an explanation about the different caches we have. */
if (keyToggledOn(keyState)) { if (keyToggledOn(keyState)) {
if (mappedKey.raw == Key_NoKey.raw) { if (mappedKey.raw == Key_NoKey.raw || keyState & EPHEMERAL) {
Layer.updateLiveCompositeKeymap(row, col); Layer.updateLiveCompositeKeymap(row, col);
} else { } else {
Layer.updateLiveCompositeKeymap(row, col, mappedKey); Layer.updateLiveCompositeKeymap(row, col, mappedKey);

@ -20,6 +20,7 @@
#include <Arduino.h> #include <Arduino.h>
#define INJECTED B10000000 #define INJECTED B10000000
#define EPHEMERAL B01000000
#define IS_PRESSED B00000010 #define IS_PRESSED B00000010
#define WAS_PRESSED B00000001 #define WAS_PRESSED B00000001

Loading…
Cancel
Save