Merge pull request #41 from algernon/h/key-lookup-in-the-looper

key_events: look up mappedKey earlier
pull/45/head
Jesse Vincent 8 years ago committed by GitHub
commit dd62680ee9

@ -50,6 +50,9 @@ Key lookup_key(byte keymap, byte row, byte col) {
} }
void handle_key_event(Key mappedKey, byte row, byte col, uint8_t currentState, uint8_t previousState) { void handle_key_event(Key mappedKey, byte row, byte col, uint8_t currentState, uint8_t previousState) {
if (mappedKey.raw == Key_NoKey.raw) {
mappedKey = lookup_key(temporary_keymap, row, col);
}
for (byte i = 0; eventHandlers[i] != NULL && i < HOOK_MAX; i++) { for (byte i = 0; eventHandlers[i] != NULL && i < HOOK_MAX; i++) {
custom_handler_t handler = eventHandlers[i]; custom_handler_t handler = eventHandlers[i];
if ((*handler)(mappedKey, row, col, currentState, previousState)) if ((*handler)(mappedKey, row, col, currentState, previousState))
@ -61,10 +64,10 @@ bool handle_key_event_default(Key mappedKey, byte row, byte col, uint8_t current
//for every newly pressed button, figure out what logical key it is and send a key down event //for every newly pressed button, figure out what logical key it is and send a key down event
// for every newly released button, figure out what logical key it is and send a key up event // for every newly released button, figure out what logical key it is and send a key up event
Key baseKey = Key_NoKey;
if (mappedKey.raw == Key_NoKey.raw) { if (mappedKey.raw == Key_NoKey.raw) {
mappedKey = lookup_key(temporary_keymap, row, col); baseKey = lookup_key(primary_keymap, row, col);
} }
Key baseKey = lookup_key(primary_keymap, row, col);
if ((baseKey.flags & SWITCH_TO_KEYMAP if ((baseKey.flags & SWITCH_TO_KEYMAP
|| baseKey.flags & SWITCH_TO_KEYMAP_MOMENTARY)) { || baseKey.flags & SWITCH_TO_KEYMAP_MOMENTARY)) {

Loading…
Cancel
Save