summaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_tap_dance.c
diff options
context:
space:
mode:
authorGergely Nagy <algernon@madhouse-project.org>2016-09-01 08:32:47 +0200
committerGergely Nagy <algernon@madhouse-project.org>2016-09-01 08:32:47 +0200
commitacda2b793f69c6e0e9b9667e9ebe8a0325eb5ecd (patch)
tree54c6b8cbee5ab1020bd57f64acccb4fed7f69907 /quantum/process_keycode/process_tap_dance.c
parente28d151a8a1d458f3c18897c6095decc17b0c3a1 (diff)
tap-dance: Do not start a sequence on keyup
There was an odd case, which confused the hell out of tap-dance: suppose you had a number of tap-dance keys, on a layer, and as part of the tap-dance, you turned that layer off - or had it on one-shot to begin with. In this case, the keydown event would trigger the tap-dance key, but the keyup would not. This had two funky consequences: - tap-dance did not correctly register that the dance has ended. - pressing any other tap-dance key would interrupt the previous tap-dance, and potentially input unwanted characters. To fix this, we simply do not start a tap-dance sequence on keyup, only when it is pressed. This way the previous sequence has enough time to time-out and finish properly, and we don't get confused. This fixes algernon/ergodox-layout#107. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
Diffstat (limited to 'quantum/process_keycode/process_tap_dance.c')
-rw-r--r--quantum/process_keycode/process_tap_dance.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index 07de3ecb8f..79ade4d000 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -65,9 +65,9 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
65 highest_td = idx; 65 highest_td = idx;
66 action = &tap_dance_actions[idx]; 66 action = &tap_dance_actions[idx];
67 67
68 action->state.keycode = keycode;
69 action->state.pressed = record->event.pressed; 68 action->state.pressed = record->event.pressed;
70 if (record->event.pressed) { 69 if (record->event.pressed) {
70 action->state.keycode = keycode;
71 action->state.count++; 71 action->state.count++;
72 action->state.timer = timer_read(); 72 action->state.timer = timer_read();
73 73
@@ -77,8 +77,9 @@ bool process_tap_dance(uint16_t keycode, keyrecord_t *record) {
77 process_tap_dance_action_on_dance_finished (paction); 77 process_tap_dance_action_on_dance_finished (paction);
78 reset_tap_dance (&paction->state); 78 reset_tap_dance (&paction->state);
79 } 79 }
80
81 last_td = keycode;
80 } 82 }
81 last_td = keycode;
82 83
83 break; 84 break;
84 85