Update `live_composite_keymap_` with specified `mappedKey`, if any

If `handleKeyswitchEvent()` is called with a `mappedKey` other than `Key_NoKey`, update
`live_composite_keymap_` with the specified `mappedKey` instead of doing a keymap lookup
on active layers. This allows a plugin to call `handleKeyswitchEvent()` and specify what
the `Key` value should be, and not have to separately track what value to change it to
every cycle.

This is especially important when there's a layer change. In particular, this is the
simplest way to allow Qukeys to use `ShiftToLayer()` keys that work properly.

Fixes #501.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/502/head
Michael Richters 6 years ago
parent 6c1cc7bd2c
commit 26ff408719

@ -81,8 +81,13 @@ 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)) {
Layer.updateLiveCompositeKeymap(row, col); if (mappedKey.raw == Key_NoKey.raw) {
Layer.updateLiveCompositeKeymap(row, col);
} else {
Layer.updateLiveCompositeKeymap(row, col, mappedKey);
}
}
/* If the key we are dealing with is masked, ignore it until it is released. /* If the key we are dealing with is masked, ignore it until it is released.
* When releasing it, clear the mask, so future key events can be handled * When releasing it, clear the mask, so future key events can be handled

Loading…
Cancel
Save