mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-25 12:46:41 +00:00
7e983796e1
* 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>
76 lines
1.7 KiB
C
76 lines
1.7 KiB
C
// Keymap helpers
|
|
|
|
#define K_ENUM(name, key, ...) name,
|
|
#define K_DATA(name, key, ...) const uint16_t PROGMEM cmb_##name[] = {__VA_ARGS__, COMBO_END};
|
|
#define K_COMB(name, key, ...) [name] = COMBO(cmb_##name, key),
|
|
|
|
#define A_ENUM(name, string, ...) name,
|
|
#define A_DATA(name, string, ...) const uint16_t PROGMEM cmb_##name[] = {__VA_ARGS__, COMBO_END};
|
|
#define A_COMB(name, string, ...) [name] = COMBO_ACTION(cmb_##name),
|
|
#define A_ACTI(name, string, ...) \
|
|
case name: \
|
|
if (pressed) SEND_STRING(string); \
|
|
break;
|
|
|
|
#define A_TOGG(name, layer, ...) \
|
|
case name: \
|
|
if (pressed) layer_invert(layer); \
|
|
break;
|
|
|
|
#define BLANK(...)
|
|
// Generate data needed for combos/actions
|
|
// Create Enum
|
|
#undef COMB
|
|
#undef SUBS
|
|
#undef TOGG
|
|
#define COMB K_ENUM
|
|
#define SUBS A_ENUM
|
|
#define TOGG A_ENUM
|
|
enum combos {
|
|
#include "combos.def"
|
|
COMBO_LENGTH
|
|
};
|
|
// Export length to combo module
|
|
uint16_t COMBO_LEN = COMBO_LENGTH;
|
|
|
|
// Bake combos into mem
|
|
#undef COMB
|
|
#undef SUBS
|
|
#undef TOGG
|
|
#define COMB K_DATA
|
|
#define SUBS A_DATA
|
|
#define TOGG A_DATA
|
|
#include "combos.def"
|
|
#undef COMB
|
|
#undef SUBS
|
|
#undef TOGG
|
|
|
|
// Fill combo array
|
|
#define COMB K_COMB
|
|
#define SUBS A_COMB
|
|
#define TOGG A_COMB
|
|
combo_t key_combos[] = {
|
|
#include "combos.def"
|
|
};
|
|
#undef COMB
|
|
#undef SUBS
|
|
#undef TOGG
|
|
|
|
// Fill QMK hook
|
|
#define COMB BLANK
|
|
#define SUBS A_ACTI
|
|
#define TOGG A_TOGG
|
|
void process_combo_event(uint16_t combo_index, bool pressed) {
|
|
switch (combo_index) {
|
|
#include "combos.def"
|
|
}
|
|
|
|
// Allow user overrides per keymap
|
|
#if __has_include("inject.h")
|
|
# include "inject.h"
|
|
#endif
|
|
}
|
|
#undef COMB
|
|
#undef SUBS
|
|
#undef TOGG
|