More reliable Shift pressing & releasing

When a shift is not pressed, press it when a TopsyTurvy key is pressed, and keep
it down as long as the TopsyTurvy key is held, too. Release it when the key
toggles off. This fixes the jitter of #1 in the case where the key is pressed
without a modifier.

In the other case, when a TopsyTurvy key is pressed while a Shift is active too,
send a report after releasing the shifts, to make sure we do not jitter here,
either.

Fixes #1.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/389/head
Gergely Nagy 8 years ago
parent cbec7c1b1a
commit a41c3dabc0

@ -83,13 +83,16 @@ namespace Akela {
// invert the shift state // invert the shift state
if (!topsyTurvyModState) { if (!topsyTurvyModState) {
Keyboard.press (Key_LShift.keyCode); if (key_is_pressed (keyState))
Keyboard.press (Key_LShift.keyCode);
handle_key_event (mappedKey, row, col, keyState | TOPSYTURVY); handle_key_event (mappedKey, row, col, keyState | TOPSYTURVY);
Keyboard.sendReport (); Keyboard.sendReport ();
Keyboard.release (Key_LShift.keyCode); if (key_toggled_off (keyState))
Keyboard.release (Key_LShift.keyCode);
} else { } else {
Keyboard.release (Key_LShift.keyCode); Keyboard.release (Key_LShift.keyCode);
Keyboard.release (Key_RShift.keyCode); Keyboard.release (Key_RShift.keyCode);
Keyboard.sendReport ();
handle_key_event (mappedKey, row, col, keyState | TOPSYTURVY); handle_key_event (mappedKey, row, col, keyState | TOPSYTURVY);
Keyboard.sendReport (); Keyboard.sendReport ();

Loading…
Cancel
Save