diff --git a/src/Akela/TopsyTurvy.cpp b/src/Akela/TopsyTurvy.cpp index 31ae9cc4..5df183f3 100644 --- a/src/Akela/TopsyTurvy.cpp +++ b/src/Akela/TopsyTurvy.cpp @@ -31,7 +31,6 @@ namespace Akela { void TopsyTurvy::begin (void) { event_handler_hook_add (this->eventHandlerHook); - loop_hook_add (this->loopHook); } void @@ -42,13 +41,11 @@ namespace Akela { void TopsyTurvy::on (void) { event_handler_hook_replace (this->noOpHook, this->eventHandlerHook); - loop_hook_replace (this->noOpLoopHook, this->loopHook); } void TopsyTurvy::off (void) { event_handler_hook_replace (this->eventHandlerHook, this->noOpHook); - loop_hook_replace (this->loopHook, this->noOpLoopHook); } Key @@ -56,19 +53,6 @@ namespace Akela { return mappedKey; } - void - TopsyTurvy::noOpLoopHook (bool postClear) { - } - - void - TopsyTurvy::loopHook (bool postClear) { - if (postClear) - return; - - bitWrite (topsyTurvyModState, 0, Keyboard.isModifierActive (Key_LShift.keyCode)); - bitWrite (topsyTurvyModState, 1, Keyboard.isModifierActive (Key_RShift.keyCode)); - } - Key TopsyTurvy::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) { if (keyState & TOPSYTURVY) @@ -77,6 +61,11 @@ namespace Akela { if (!topsyTurvyList) return mappedKey; + if (mappedKey.raw == Key_LShift.raw) + bitWrite (topsyTurvyModState, 0, key_is_pressed (keyState)); + if (mappedKey.raw == Key_RShift.raw) + bitWrite (topsyTurvyModState, 1, key_is_pressed (keyState)); + if (!key_is_pressed (keyState) && !key_was_pressed (keyState)) return mappedKey; diff --git a/src/Akela/TopsyTurvy.h b/src/Akela/TopsyTurvy.h index bc4fabb3..d62e828f 100644 --- a/src/Akela/TopsyTurvy.h +++ b/src/Akela/TopsyTurvy.h @@ -38,9 +38,6 @@ namespace Akela { static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState); static Key noOpHook (Key, byte row, byte col, uint8_t keyState); - - static void loopHook (bool postClear); - static void noOpLoopHook (bool postClear); }; };