diff options
author | Pete Sevander <pete.sevander@gmail.com> | 2023-05-10 18:59:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-10 17:59:52 +0200 |
commit | 8a332e6f0105d2db9239e3c3f997bae754522804 (patch) | |
tree | fb8d79bf1d0bbfde46384227992d7bfd70942b96 /quantum | |
parent | 6f2a1e4e17fcba9183c6f4f126383d99d9d714f8 (diff) |
Fix Mod-Tap combo regression (#20669)
* Add keyevent for combo keyrecord
* Fix formatting
* Update quantum/process_keycode/process_combo.c
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
* Add combo unit-tests and hot-fix process_record_tap_hint
...as this function tries to lookup the combo keys passed in. This will
be refactored in a later pr.
---------
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/action.c | 8 | ||||
-rw-r--r-- | quantum/action_tapping.c | 10 | ||||
-rw-r--r-- | quantum/process_keycode/process_combo.c | 1 |
3 files changed, 13 insertions, 6 deletions
diff --git a/quantum/action.c b/quantum/action.c index 9a6bbcca11..41c204f689 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -187,7 +187,7 @@ bool is_swap_hands_on(void) { */ void process_hand_swap(keyevent_t *event) { keypos_t pos = event->key; - if (pos.row < MATRIX_ROWS && pos.col < MATRIX_COLS) { + if (IS_KEYEVENT(*event) && pos.row < MATRIX_ROWS && pos.col < MATRIX_COLS) { static uint8_t matrix_swap_state[((MATRIX_ROWS * MATRIX_COLS) + (CHAR_BIT)-1) / (CHAR_BIT)]; size_t index = (size_t)(pos.row * MATRIX_COLS) + pos.col; bool do_swap = should_swap_hands(index, matrix_swap_state, event->pressed); @@ -200,7 +200,7 @@ void process_hand_swap(keyevent_t *event) { } } # ifdef ENCODER_MAP_ENABLE - else if (pos.row == KEYLOC_ENCODER_CW || pos.row == KEYLOC_ENCODER_CCW) { + else if (IS_ENCODEREVENT(*event) && pos.row == KEYLOC_ENCODER_CW || pos.row == KEYLOC_ENCODER_CCW) { static uint8_t encoder_swap_state[((NUM_ENCODERS) + (CHAR_BIT)-1) / (CHAR_BIT)]; size_t index = pos.col; bool do_swap = should_swap_hands(index, encoder_swap_state, event->pressed); @@ -242,6 +242,10 @@ __attribute__((weak)) void post_process_record_quantum(keyrecord_t *record) {} * FIXME: Needs documentation. */ void process_record_tap_hint(keyrecord_t *record) { + if (!IS_KEYEVENT(record->event)) { + return; + } + action_t action = layer_switch_get_action(record->event.key); switch (action.kind.id) { diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c index 362b15105c..f94e5e6f69 100644 --- a/quantum/action_tapping.c +++ b/quantum/action_tapping.c @@ -167,8 +167,10 @@ bool process_tapping(keyrecord_t *keyp) { // state machine is in the "reset" state, no tapping key is to be // processed - if (IS_NOEVENT(tapping_key.event) && IS_EVENT(event)) { - if (event.pressed && is_tap_record(keyp)) { + if (IS_NOEVENT(tapping_key.event)) { + if (!IS_EVENT(event)) { + // early return for tick events + } else if (event.pressed && is_tap_record(keyp)) { // the currently pressed key is a tapping key, therefore transition // into the "pressed" tapping key state ac_dprintf("Tapping: Start(Press tap key).\n"); @@ -176,13 +178,13 @@ bool process_tapping(keyrecord_t *keyp) { process_record_tap_hint(&tapping_key); waiting_buffer_scan_tap(); debug_tapping_key(); - return true; } else { // the current key is just a regular key, pass it on for regular // processing process_record(keyp); - return true; } + + return true; } TAP_DEFINE_KEYCODE; diff --git a/quantum/process_keycode/process_combo.c b/quantum/process_keycode/process_combo.c index b1b49d3019..2670ccabed 100644 --- a/quantum/process_keycode/process_combo.c +++ b/quantum/process_keycode/process_combo.c @@ -335,6 +335,7 @@ void apply_combo(uint16_t combo_index, combo_t *combo) { // this in the end executes the combo when the key_buffer is dumped. record->keycode = combo->keycode; record->event.type = COMBO_EVENT; + record->event.key = MAKE_KEYPOS(0, 0); qrecord->combo_index = combo_index; ACTIVATE_COMBO(combo); |