From d893a9bca07582b741de07d3819eb31866de01db Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Mon, 12 Aug 2024 12:24:59 +0200 Subject: sync ACHORDION_STREAK fix and enable it again --- common/achordion.c | 37 ++++++++++++++++++++++--------------- common/config.h | 2 +- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/common/achordion.c b/common/achordion.c index 2db1113..07c1835 100644 --- a/common/achordion.c +++ b/common/achordion.c @@ -77,7 +77,13 @@ static void update_streak_timer(uint16_t keycode, keyrecord_t* record) { // Calls `process_record()` with state set to RECURSING. static void recursively_process_record(keyrecord_t* record, uint8_t state) { achordion_state = STATE_RECURSING; +#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE) + int8_t mouse_key_tracker = get_auto_mouse_key_tracker(); +#endif process_record(record); +#if defined(POINTING_DEVICE_ENABLE) && defined(POINTING_DEVICE_AUTO_MOUSE_ENABLE) + set_auto_mouse_key_tracker(mouse_key_tracker); +#endif achordion_state = state; } @@ -118,21 +124,6 @@ static void settle_as_tap(void) { tap_hold_record.event.pressed = false; // Plumb tap release event. recursively_process_record(&tap_hold_record, STATE_TAPPING); -#ifdef ACHORDION_STREAK - update_streak_timer(keycode, record); - if (is_streak && is_key_event && is_tap_hold && record->tap.count == 0) { - // If we are in a streak and resolved the current tap-hold key as a tap - // consider the next tap-hold key as active to be resolved next. - update_streak_timer(tap_hold_keycode, &tap_hold_record); - const uint16_t timeout = achordion_timeout(keycode); - tap_hold_keycode = keycode; - tap_hold_record = *record; - hold_timer = record->event.time + timeout; - achordion_state = STATE_UNSETTLED; - pressed_another_key_before_release = false; - return false; - } -#endif } bool process_achordion(uint16_t keycode, keyrecord_t* record) { @@ -262,6 +253,22 @@ bool process_achordion(uint16_t keycode, keyrecord_t* record) { #endif // REPEAT_KEY_ENABLE } else { settle_as_tap(); + +#ifdef ACHORDION_STREAK + update_streak_timer(keycode, record); + if (is_streak && is_key_event && is_tap_hold && record->tap.count == 0) { + // If we are in a streak and resolved the current tap-hold key as a tap + // consider the next tap-hold key as active to be resolved next. + update_streak_timer(tap_hold_keycode, &tap_hold_record); + const uint16_t timeout = achordion_timeout(keycode); + tap_hold_keycode = keycode; + tap_hold_record = *record; + hold_timer = record->event.time + timeout; + achordion_state = STATE_UNSETTLED; + pressed_another_key_before_release = false; + return false; + } +#endif } recursively_process_record(record, achordion_state); // Re-process event. diff --git a/common/config.h b/common/config.h index dc12f33..84cc6de 100644 --- a/common/config.h +++ b/common/config.h @@ -38,7 +38,7 @@ // details see https://precondition.github.io/home-row-mods // detect typing streaks -//#define ACHORDION_STREAK +#define ACHORDION_STREAK // Enable rapid switch from tap to hold, disables double tap hold auto-repeat. #define QUICK_TAP_TERM 0 -- cgit v1.2.3