Merge 3bd5a82022c423dc5b213c253a3626908bfcbce7 into 5eb60827d5ba65c7f56307390a499bec75dfea8b

This commit is contained in:
John
2025-01-04 03:18:28 -08:00
committed by GitHub
2 changed files with 446 additions and 12 deletions

View File

@ -47,7 +47,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
int tp_buttons;
#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
int retro_tapping_counter = 0;
bool retro_tap_primed = false;
uint16_t retro_tap_curr_key = 0;
# if !(defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
uint8_t retro_tap_curr_mods = 0;
uint8_t retro_tap_next_mods = 0;
# endif
#endif
#if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING)
@ -77,7 +82,13 @@ void action_exec(keyevent_t event) {
debug_event(event);
ac_dprintf("\n");
#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
retro_tapping_counter++;
uint16_t event_keycode = get_event_keycode(event, false);
if (event.pressed) {
retro_tap_primed = false;
retro_tap_curr_key = event_keycode;
} else if (retro_tap_curr_key == event_keycode) {
retro_tap_primed = true;
}
#endif
}
@ -531,7 +542,8 @@ void process_action(keyrecord_t *record, action_t action) {
# if defined(RETRO_TAPPING) && defined(DUMMY_MOD_NEUTRALIZER_KEYCODE)
// Send a dummy keycode to neutralize flashing modifiers
// if the key was held and then released with no interruptions.
if (retro_tapping_counter == 2) {
uint16_t ev_kc = get_event_keycode(event, false);
if (retro_tap_primed && retro_tap_curr_key == ev_kc) {
neutralize_flashing_modifiers(get_mods());
}
# endif
@ -825,30 +837,44 @@ void process_action(keyrecord_t *record, action_t action) {
#ifndef NO_ACTION_TAPPING
# if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
if (!is_tap_action(action)) {
retro_tapping_counter = 0;
} else {
if (is_tap_action(action)) {
if (event.pressed) {
if (tap_count > 0) {
retro_tapping_counter = 0;
retro_tap_primed = false;
} else {
# if !(defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
retro_tap_curr_mods = retro_tap_next_mods;
retro_tap_next_mods = get_mods();
# endif
}
} else {
uint16_t event_keycode = get_event_keycode(event, false);
# if !(defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
uint8_t curr_mods = get_mods();
# endif
if (tap_count > 0) {
retro_tapping_counter = 0;
} else {
retro_tap_primed = false;
} else if (retro_tap_curr_key == event_keycode) {
if (
# ifdef RETRO_TAPPING_PER_KEY
get_retro_tapping(get_event_keycode(record->event, false), record) &&
get_retro_tapping(event_keycode, record) &&
# endif
retro_tapping_counter == 2) {
retro_tap_primed) {
# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)
process_auto_shift(action.layer_tap.code, record);
# else
register_mods(retro_tap_curr_mods);
wait_ms(TAP_CODE_DELAY);
tap_code(action.layer_tap.code);
wait_ms(TAP_CODE_DELAY);
unregister_mods(retro_tap_curr_mods);
# endif
}
retro_tapping_counter = 0;
retro_tap_primed = false;
}
# if !(defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT))
retro_tap_next_mods = curr_mods;
# endif
}
}
# endif

File diff suppressed because it is too large Load Diff