Fixed layer-shift bugs

Layer changes didn't take effect immediately, and a ShiftToLayer(n) alternate keycode was
never released properly, so it was effectively a LockLayer(n) key. This patch fixes both
problems.

Fixes #28
pull/389/head
Michael Richters 7 years ago
parent 238f1faaff
commit f6f5f9ae3b

@ -97,8 +97,6 @@ void Qukeys::flushKey(bool qukey_state, uint8_t keyswitch_state) {
Key keycode = Key_NoKey;
if (qukey_state == QUKEY_STATE_ALTERNATE && qukey_index != QUKEY_NOT_FOUND) {
keycode = qukeys[qukey_index].alt_keycode;
} else {
keycode = Layer.lookup(row, col);
}
// Before calling handleKeyswitchEvent() below, make sure Qukeys knows not to handle
@ -200,10 +198,16 @@ Key Qukeys::keyScanHook(Key mapped_key, byte row, byte col, uint8_t key_state) {
if (keyToggledOff(key_state)) {
// If the key isn't in the key_queue, proceed
if (queue_index == QUKEY_NOT_FOUND) {
// If a qukey was released while in its alternate state, change its keycode
if (qukey_index != QUKEY_NOT_FOUND &&
getQukeyState(key_addr) == QUKEY_STATE_ALTERNATE) {
return qukeys[qukey_index].alt_keycode;
}
return mapped_key;
}
flushQueue(queue_index);
return mapped_key;
// flushQueue() has already handled this key release
return Key_NoKey;
}
// Otherwise, the key is still pressed

Loading…
Cancel
Save