Simplify the normal, "unshifted" case

Instead of injecting a new event, modify `mapped_key` instead, and give it a
`SHIFT_HELD` flag.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/389/head
Gergely Nagy 6 years ago
parent 209a92b6e0
commit 62f9fe481d

@ -55,14 +55,10 @@ EventHandlerResult TopsyTurvy::onKeyswitchEvent(Key &mapped_key, byte row, byte
return EventHandlerResult::OK; return EventHandlerResult::OK;
// invert the shift state // invert the shift state
if (!mod_state_) { if (!mod_state_) {
if (keyIsPressed(key_state)) mapped_key.raw = mapped_key.raw - ranges::TT_FIRST;
hid::pressRawKey(Key_LeftShift); mapped_key.flags |= SHIFT_HELD;
handleKeyswitchEvent(new_key, row, col, key_state | TOPSYTURVY | INJECTED); return EventHandlerResult::OK;
hid::sendKeyboardReport();
if (keyToggledOff(key_state))
hid::releaseRawKey(Key_LeftShift);
} else { } else {
hid::releaseRawKey(Key_LeftShift); hid::releaseRawKey(Key_LeftShift);
hid::releaseRawKey(Key_RightShift); hid::releaseRawKey(Key_RightShift);

Loading…
Cancel
Save