You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.2 KiB

Process combos earlier & overlapping combos (#8591) * Combo processing improvements. Now it is possible to use ModTap and LayerTap keys as part of combos. Overlapping combos also don't trigger all the combos, just exactly the one that you press. New settings: - COMBO_MUST_HOLD_MODS - COMBO_MOD_TERM - COMBO_TERM_PER_COMBO - COMBO_MUST_HOLD_PER_COMBO - COMBO_STRICT_TIMER - COMBO_NO_TIMER * Remove the size flags from combo_t struct boolean members. This in the end actually saves space as the members are accessed so many times. The amount of operations needed to access the bits uses more memory than setting the size saves. * Fix `process_combo_key_release` not called correctly with tap-only combos * Fix not passing a pointer when NO_ACTION_TAPPING is defined. * Docs for `COMBO_ONLY_FROM_LAYER` * Update docs/feature_combo.md Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> * Update quantum/process_keycode/process_combo.c Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> * Add `EXTRA_SHORT_COMBOS` option. Stuff combo's `disabled` and `active` flags into `state`. Possibly can save some space. * Add more examples and clarify things with dict management system. - Simple examples now has a combo that has modifiers included. - The slightly more advanced examples now are actually more advanced instead of just `tap_code16(<modded-keycode>)`. - Added a note that `COMBO_ACTION`s are not needed anymore as you can just use custom keycodes. - Added a note that the `g/keymap_combo.h` macros use the `process_combo_event` function and that it is not usable in one's keymap afterwards. * Update docs/feature_combo.md Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> * Update docs/feature_combo.md Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> * Update docs/feature_combo.md Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> * Update docs/feature_combo.md Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> * Update docs/feature_combo.md Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> * Change "the" combo action example to "email" example. * Update docs/feature_combo.md Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> * Fix sneaky infinite loop with `combo_disable()` No need to call `dump_key_buffer` when disabling combos because the buffer is either being dumped if a combo-key was pressed, or the buffer is empty if a non-combo-key is pressed. * Update docs/feature_combo.md Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> * Update docs/feature_combo.md Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> Co-authored-by: precondition <57645186+precondition@users.noreply.github.com> Co-authored-by: Drashna Jaelre <drashna@live.com>
2 years ago
  1. /*
  2. Copyright 2013 Jun Wako <wakojun@gmail.com>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #pragma once
  15. /* period of tapping(ms) */
  16. #ifndef TAPPING_TERM
  17. # define TAPPING_TERM 200
  18. #endif
  19. /* period of quick tap(ms) */
  20. #if !defined(QUICK_TAP_TERM) || QUICK_TAP_TERM > TAPPING_TERM
  21. # define QUICK_TAP_TERM TAPPING_TERM
  22. #endif
  23. /* tap count needed for toggling a feature */
  24. #ifndef TAPPING_TOGGLE
  25. # define TAPPING_TOGGLE 5
  26. #endif
  27. #define WAITING_BUFFER_SIZE 8
  28. #ifndef NO_ACTION_TAPPING
  29. uint16_t get_record_keycode(keyrecord_t *record, bool update_layer_cache);
  30. uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache);
  31. void action_tapping_process(keyrecord_t record);
  32. #endif
  33. uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record);
  34. uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record);
  35. bool get_permissive_hold(uint16_t keycode, keyrecord_t *record);
  36. bool get_retro_tapping(uint16_t keycode, keyrecord_t *record);
  37. bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record);
  38. #ifdef DYNAMIC_TAPPING_TERM_ENABLE
  39. extern uint16_t g_tapping_term;
  40. #endif
  41. #if defined(TAPPING_TERM_PER_KEY) && !defined(NO_ACTION_TAPPING)
  42. # define GET_TAPPING_TERM(keycode, record) get_tapping_term(keycode, record)
  43. #elif defined(DYNAMIC_TAPPING_TERM_ENABLE) && !defined(NO_ACTION_TAPPING)
  44. # define GET_TAPPING_TERM(keycode, record) g_tapping_term
  45. #else
  46. # define GET_TAPPING_TERM(keycode, record) (TAPPING_TERM)
  47. #endif
  48. #ifdef QUICK_TAP_TERM_PER_KEY
  49. # define GET_QUICK_TAP_TERM(keycode, record) get_quick_tap_term(keycode, record)
  50. #else
  51. # define GET_QUICK_TAP_TERM(keycode, record) (QUICK_TAP_TERM)
  52. #endif