From 29f64d7a93d941167c6c6e95f893ab84586b2205 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Wed, 17 Aug 2016 13:04:50 +0200 Subject: tap-dance: Major rework, to make it more reliable This reworks how the tap-dance feature works: instead of one global state, we have a state for each tap-dance key, so we can cancel them when another tap-dance key is in flight. This fixes #527. Since we have a state for each key, we can avoid situation where a keyup would mess with our global state. This fixes #563. And while here, we also make sure to fire events only once, and this fixes #574. There is one breaking change, though: tap-dance debugging support was removed, because dumping the whole state would increase the firmware size too much. Any keymap that made use of this, will have to be updated (but there's no such keymap in the repo). Also, there's a nice trick used in this rework: we need to iterate through tap_dance_actions in a few places, to check for timeouts, and so on. For this, we'd need to know the size of the array. We can't discover that at compile-time, because tap-dance gets compiled separately. We'd like to avoid having to terminate the list with a sentinel value, because that would require updates to all keymaps that use the feature. So, we keep track of the highest tap-dance code seen so far, and iterate until that index. Signed-off-by: Gergely Nagy --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index e2221e749..8c07a5d1f 100644 --- a/readme.md +++ b/readme.md @@ -431,7 +431,7 @@ enum { }; //Tap Dance Definitions -const qk_tap_dance_action_t tap_dance_actions[] = { +qk_tap_dance_action_t tap_dance_actions[] = { //Tap once for Esc, twice for Caps Lock [TD_ESC_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_ESC, KC_CAPS) // Other declarations would go here, separated by commas, if you have them @@ -517,7 +517,7 @@ void dance_flsh_reset(qk_tap_dance_state_t *state, void *user_data) { ergodox_right_led_3_off(); } -const qk_tap_dance_action_t tap_dance_actions[] = { +qk_tap_dance_action_t tap_dance_actions[] = { [CT_SE] = ACTION_TAP_DANCE_DOUBLE (KC_SPC, KC_ENT) ,[CT_CLN] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, dance_cln_finished, dance_cln_reset) ,[CT_EGG] = ACTION_TAP_DANCE_FN (dance_egg) -- cgit v1.2.3-24-g4f1b