From a940f70fc7c376a9d69337c4f5158ce54b542ef8 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 18 Dec 2018 14:03:11 -0600 Subject: [PATCH] Removed obsolete code for updating mapped_key With the changes to the updating of `Layer.live_composite_keymap_`, the code that changes the `mapped_key` values for keys that have been flushed from the queue is unnecessary. Signed-off-by: Michael Richters --- src/kaleidoscope/plugin/Qukeys.cpp | 49 ++++-------------------------- 1 file changed, 6 insertions(+), 43 deletions(-) diff --git a/src/kaleidoscope/plugin/Qukeys.cpp b/src/kaleidoscope/plugin/Qukeys.cpp index d356224c..7204c1b1 100644 --- a/src/kaleidoscope/plugin/Qukeys.cpp +++ b/src/kaleidoscope/plugin/Qukeys.cpp @@ -268,12 +268,6 @@ EventHandlerResult Qukeys::onKeyswitchEvent(Key &mapped_key, byte row, byte col, return EventHandlerResult::OK; } - // If the key isn't active, and didn't just toggle off, continue to next plugin - if (!keyIsPressed(key_state) && !keyWasPressed(key_state)) { - mapped_key = getDualUsePrimaryKey(mapped_key); - return EventHandlerResult::OK; - } - // If the key was just pressed: if (keyToggledOn(key_state)) { // If the queue is empty and the key isn't a qukey, proceed: @@ -296,18 +290,6 @@ EventHandlerResult Qukeys::onKeyswitchEvent(Key &mapped_key, byte row, byte col, 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 (isDualUse(mapped_key)) { - if (getQukeyState(key_addr) == QUKEY_STATE_ALTERNATE) { - mapped_key = getDualUseAlternateKey(mapped_key); - } else { - mapped_key = getDualUsePrimaryKey(mapped_key); - } - } else if (qukey_index != QUKEY_NOT_FOUND) { - if (getQukeyState(key_addr) == QUKEY_STATE_ALTERNATE) { - mapped_key = qukeys[qukey_index].alt_keycode; - } - } return EventHandlerResult::OK; } flushQueue(queue_index); @@ -318,34 +300,15 @@ EventHandlerResult Qukeys::onKeyswitchEvent(Key &mapped_key, byte row, byte col, // Otherwise, the key is still pressed - // If the key is not a qukey: - if (qukey_index == QUKEY_NOT_FOUND && - ! isDualUse(mapped_key)) { - // If the key was pressed before the keys in the queue, proceed: - if (queue_index == QUKEY_NOT_FOUND) { - return EventHandlerResult::OK; - } else { - // suppress this keypress; it's still in the queue - return EventHandlerResult::EVENT_CONSUMED; - } - } - - // If the qukey is not in the queue, check its state + // Only keys in the queue can still evaluate as qukeys, so all we need to do here is + // block events for held keys that are still in the queue. if (queue_index == QUKEY_NOT_FOUND) { - if (getQukeyState(key_addr) == QUKEY_STATE_ALTERNATE) { - if (isDualUse(mapped_key)) { - mapped_key = getDualUseAlternateKey(mapped_key); - } else { - mapped_key = qukeys[qukey_index].alt_keycode; - } - } else { // qukey_state == QUKEY_STATE_PRIMARY - mapped_key = getDualUsePrimaryKey(mapped_key); - } + // The key is not in the queue; proceed: return EventHandlerResult::OK; + } else { + // The key is still in the queue; abort: + return EventHandlerResult::EVENT_CONSUMED; } - // else state is undetermined; block. I could check timeouts here, - // but I'd rather do that in the pre-report hook - return EventHandlerResult::EVENT_CONSUMED; } EventHandlerResult Qukeys::beforeReportingState() {