From efe520645ec8b67d306eb63f54b0a52380269596 Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 27 Oct 2022 23:59:58 +1100 Subject: [PATCH] Normalise Combo keycodes (#18877) --- docs/feature_combo.md | 10 +++++----- keyboards/centromere/keymaps/mini_bom/keymap.c | 2 +- .../gboards/gergoplex/keymaps/colemak-dhm/keymap.c | 2 +- keyboards/gboards/gergoplex/keymaps/default/keymap.c | 2 +- keyboards/ymdk/melody96/keymaps/dvz/keymap.c | 4 ++-- quantum/process_keycode/process_combo.c | 6 +++--- quantum/quantum_keycodes.h | 11 ++++++++--- quantum/quantum_keycodes_legacy.h | 4 ++++ 8 files changed, 25 insertions(+), 16 deletions(-) diff --git a/docs/feature_combo.md b/docs/feature_combo.md index bb0b5d7aa05..2696ff68334 100644 --- a/docs/feature_combo.md +++ b/docs/feature_combo.md @@ -105,11 +105,11 @@ It is worth noting that `COMBO_ACTION`s are not needed anymore. As of [PR#8591]( ## Keycodes You can enable, disable and toggle the Combo feature on the fly. This is useful if you need to disable them temporarily, such as for a game. The following keycodes are available for use in your `keymap.c` -|Keycode |Description | -|----------|---------------------------------| -|`CMB_ON` |Turns on Combo feature | -|`CMB_OFF` |Turns off Combo feature | -|`CMB_TOG` |Toggles Combo feature on and off | +|Keycode |Aliases |Description | +|-----------------|---------|--------------------------------| +|`QK_COMBO_ON` |`CM_ON` |Turns on Combo feature | +|`QK_COMBO_OFF` |`CM_OFF` |Turns off Combo feature | +|`QK_COMBO_TOGGLE`|`CM_TOGG`|Toggles Combo feature on and off| # Advanced Configuration These configuration settings can be set in your `config.h` file. diff --git a/keyboards/centromere/keymaps/mini_bom/keymap.c b/keyboards/centromere/keymaps/mini_bom/keymap.c index 75b2ea08f17..82e68aafa58 100644 --- a/keyboards/centromere/keymaps/mini_bom/keymap.c +++ b/keyboards/centromere/keymaps/mini_bom/keymap.c @@ -97,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_NO, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, KC_TILD, KC_TRNS, KC_TRNS, KC_BSLS, KC_NO, KC_NO, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_BTN2, KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_QUOT, KC_NO, KC_NO, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_BTN1, KC_AMPR, KC_EQL, KC_COMM, KC_DOT, KC_MINS, KC_NO, - CMB_TOG, KC_SCLN, KC_EQL, KC_EQL, KC_SCLN, KC_DEL + CM_TOGG, KC_SCLN, KC_EQL, KC_EQL, KC_SCLN, KC_DEL ), /* Keymap 2: Pad/Function layer diff --git a/keyboards/gboards/gergoplex/keymaps/colemak-dhm/keymap.c b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/keymap.c index ec2c17f8bca..19b5f122ca5 100644 --- a/keyboards/gboards/gergoplex/keymaps/colemak-dhm/keymap.c +++ b/keyboards/gboards/gergoplex/keymaps/colemak-dhm/keymap.c @@ -76,7 +76,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, KC_TILD, KC_TRNS, KC_TRNS, KC_BSLS, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_BTN2, KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_QUOT, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_BTN1, KC_AMPR, KC_EQL, KC_COMM, KC_DOT, KC_MINS, - CMB_TOG, KC_SCLN, KC_EQL, KC_EQL, KC_SCLN, KC_DEL), + CM_TOGG, KC_SCLN, KC_EQL, KC_EQL, KC_SCLN, KC_DEL), /* Keymap 2: Numbers/Function/Motion layer * diff --git a/keyboards/gboards/gergoplex/keymaps/default/keymap.c b/keyboards/gboards/gergoplex/keymaps/default/keymap.c index c6327512046..7728304a9ae 100644 --- a/keyboards/gboards/gergoplex/keymaps/default/keymap.c +++ b/keyboards/gboards/gergoplex/keymaps/default/keymap.c @@ -90,7 +90,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_GRV, KC_TILD, KC_TRNS, KC_TRNS, KC_BSLS, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_BTN2, KC_PLUS, KC_MINS, KC_SLSH, KC_ASTR, KC_QUOT, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_BTN1, KC_AMPR, KC_EQL, KC_COMM, KC_DOT, KC_MINS, - CMB_TOG, KC_SCLN, KC_EQL, KC_EQL, KC_SCLN, KC_DEL), + CM_TOGG, KC_SCLN, KC_EQL, KC_EQL, KC_SCLN, KC_DEL), /* Keymap 2: Numbers/Function/Motion layer * diff --git a/keyboards/ymdk/melody96/keymaps/dvz/keymap.c b/keyboards/ymdk/melody96/keymaps/dvz/keymap.c index ff19e2c3937..c0f6d886635 100644 --- a/keyboards/ymdk/melody96/keymaps/dvz/keymap.c +++ b/keyboards/ymdk/melody96/keymaps/dvz/keymap.c @@ -56,7 +56,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_TRNS, RGB_TOG, KC_TRNS, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, BL_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, CMB_TOG, BL_TOGG, BL_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, CM_TOGG, BL_TOGG, BL_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGUP, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_END, KC_TRNS, KC_TRNS, KC_MUTE), [2] = LAYOUT( @@ -133,7 +133,7 @@ void post_process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case KC_CAPS: case KC_MUTE: - case CMB_TOG: + case QK_COMBO_TOGGLE: if (record->event.pressed) { rgblight_blink_layer(4, 250); } diff --git a/quantum/process_keycode/process_combo.c b/quantum/process_keycode/process_combo.c index e5135e5a645..d8b089db16e 100644 --- a/quantum/process_keycode/process_combo.c +++ b/quantum/process_keycode/process_combo.c @@ -531,17 +531,17 @@ bool process_combo(uint16_t keycode, keyrecord_t *record) { bool is_combo_key = false; bool no_combo_keys_pressed = true; - if (keycode == CMB_ON && record->event.pressed) { + if (keycode == QK_COMBO_ON && record->event.pressed) { combo_enable(); return true; } - if (keycode == CMB_OFF && record->event.pressed) { + if (keycode == QK_COMBO_OFF && record->event.pressed) { combo_disable(); return true; } - if (keycode == CMB_TOG && record->event.pressed) { + if (keycode == QK_COMBO_TOGGLE && record->event.pressed) { combo_toggle(); return true; } diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 36cb01b5f5a..a3f9888ffc2 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -408,9 +408,9 @@ enum quantum_keycodes { QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE, // 5CF7 // Combos - CMB_ON, // 5CF8 - CMB_OFF, // 5CF9 - CMB_TOG, // 5CFA + QK_COMBO_ON, // 5CF8 + QK_COMBO_OFF, // 5CF9 + QK_COMBO_TOGGLE, // 5CFA // Magic (continued) MAGIC_SWAP_LCTL_LGUI, // 5CFB @@ -872,6 +872,11 @@ enum quantum_keycodes { #define SC_RAPC QK_SPACE_CADET_RIGHT_ALT_PARENTHESIS_CLOSE #define SC_SENT QK_SPACE_CADET_RIGHT_SHIFT_ENTER +// Combos +#define CM_ON QK_COMBO_ON +#define CM_OFF QK_COMBO_OFF +#define CM_TOGG QK_COMBO_TOGGLE + // Swap Hands #define SH_T(kc) (QK_SWAP_HANDS | (kc)) #define SH_TG (QK_SWAP_HANDS | OP_SH_TOGGLE) diff --git a/quantum/quantum_keycodes_legacy.h b/quantum/quantum_keycodes_legacy.h index 92ec68b622e..a6023dee307 100644 --- a/quantum/quantum_keycodes_legacy.h +++ b/quantum/quantum_keycodes_legacy.h @@ -18,6 +18,10 @@ #define ONESHOT_DISABLE QK_ONE_SHOT_OFF #define ONESHOT_TOGGLE QK_ONE_SHOT_TOGGLE +#define CMB_ON QK_COMBO_ON +#define CMB_OFF QK_COMBO_OFF +#define CMB_TOG QK_COMBO_TOGGLE + #define PROGRAMMABLE_BUTTON_1 QK_PROGRAMMABLE_BUTTON_1 #define PROGRAMMABLE_BUTTON_2 QK_PROGRAMMABLE_BUTTON_2 #define PROGRAMMABLE_BUTTON_3 QK_PROGRAMMABLE_BUTTON_3