aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/action.h
diff options
context:
space:
mode:
authorPete Sevander <pete.sevander@gmail.com>2021-08-06 02:44:57 +0300
committerGitHub <noreply@github.com>2021-08-06 09:44:57 +1000
commit7e983796e18e7401c062c158f23966aeb7b1405b (patch)
tree88d6897d7ca4f6103f03c1941dac6736ba477361 /tmk_core/common/action.h
parent07553b41f0a03ca6549c09cecf9cd3dec7332346 (diff)
downloadqmk_firmware-7e983796e18e7401c062c158f23966aeb7b1405b.tar.gz
qmk_firmware-7e983796e18e7401c062c158f23966aeb7b1405b.zip
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>
Diffstat (limited to 'tmk_core/common/action.h')
-rw-r--r--tmk_core/common/action.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h
index 8cb4722c6..3d357b33b 100644
--- a/tmk_core/common/action.h
+++ b/tmk_core/common/action.h
@@ -53,6 +53,9 @@ typedef struct {
53#ifndef NO_ACTION_TAPPING 53#ifndef NO_ACTION_TAPPING
54 tap_t tap; 54 tap_t tap;
55#endif 55#endif
56#ifdef COMBO_ENABLE
57 uint16_t keycode;
58#endif
56} keyrecord_t; 59} keyrecord_t;
57 60
58/* Execute action per keyevent */ 61/* Execute action per keyevent */
@@ -60,6 +63,7 @@ void action_exec(keyevent_t event);
60 63
61/* action for key */ 64/* action for key */
62action_t action_for_key(uint8_t layer, keypos_t key); 65action_t action_for_key(uint8_t layer, keypos_t key);
66action_t action_for_keycode(uint16_t keycode);
63 67
64/* macro */ 68/* macro */
65const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt); 69const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
@@ -111,6 +115,7 @@ void clear_keyboard_but_mods(void);
111void clear_keyboard_but_mods_and_keys(void); 115void clear_keyboard_but_mods_and_keys(void);
112void layer_switch(uint8_t new_layer); 116void layer_switch(uint8_t new_layer);
113bool is_tap_key(keypos_t key); 117bool is_tap_key(keypos_t key);
118bool is_tap_record(keyrecord_t *record);
114bool is_tap_action(action_t action); 119bool is_tap_action(action_t action);
115 120
116#ifndef NO_ACTION_TAPPING 121#ifndef NO_ACTION_TAPPING