diff options
author | ridingqwerty <george.g.koenig@gmail.com> | 2020-02-25 13:25:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-25 13:25:52 -0500 |
commit | b949343b783da729b1dfebd38507cc56a8cd12e3 (patch) | |
tree | 6f35b98c798d071c5ce6603f62d5088da760b5d0 /tmk_core/common | |
parent | f6111d49bbfeb90fdb86c4595ba339590b364da7 (diff) |
New feature: PERMISSIVE_HOLD_PER_KEY (#7994)
* Implement 'PERMISSIVE_HOLD_PER_KEY'
* Document 'PERMISSIVE_HOLD_PER_KEY'
Co-authored-by: GeorgeKoenig <35542036+GeorgeKoenig@users.noreply.github.com>
Diffstat (limited to 'tmk_core/common')
-rw-r--r-- | tmk_core/common/action_tapping.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index c0f1f694b7..65ef0a1859 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c @@ -31,6 +31,10 @@ __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode) { return TAPPI __attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { return false; } # endif +# ifdef PERMISSIVE_HOLD_PER_KEY +__attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { return false; } +# endif + static keyrecord_t tapping_key = {}; static keyrecord_t waiting_buffer[WAITING_BUFFER_SIZE] = {}; static uint8_t waiting_buffer_head = 0; @@ -115,12 +119,15 @@ bool process_tapping(keyrecord_t *keyp) { * This can register the key before settlement of tapping, * useful for long TAPPING_TERM but may prevent fast typing. */ -# if defined(TAPPING_TERM_PER_KEY) || (TAPPING_TERM >= 500) || defined(PERMISSIVE_HOLD) +# if defined(TAPPING_TERM_PER_KEY) || (TAPPING_TERM >= 500) || defined(PERMISSIVE_HOLD) || defined(PERMISSIVE_HOLD_PER_KEY) + else if ( # ifdef TAPPING_TERM_PER_KEY - else if ((get_tapping_term(get_event_keycode(tapping_key.event)) >= 500) && IS_RELEASED(event) && waiting_buffer_typed(event)) -# else - else if (IS_RELEASED(event) && waiting_buffer_typed(event)) + (get_tapping_term(get_event_keycode(tapping_key.event)) >= 500) && +# endif +# ifdef PERMISSIVE_HOLD_PER_KEY + !get_permissive_hold(get_event_keycode(tapping_key.event), keyp) && # endif + IS_RELEASED(event) && waiting_buffer_typed(event)) { debug("Tapping: End. No tap. Interfered by typing key\n"); process_record(&tapping_key); |