From d9393b86842b7ef143259b5f771ae7969f98cbb4 Mon Sep 17 00:00:00 2001 From: Isaac Elenbaas Date: Thu, 25 Nov 2021 07:12:14 -0500 Subject: Add Retro Shift (Auto Shift for Tap Hold via Retro Tapping) and Custom Auto Shifts (#11059) * Add Retro Shift and Custom Auto Shifts * Fix compilation errors with no RETRO_SHIFT value --- quantum/action.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'quantum/action.c') diff --git a/quantum/action.c b/quantum/action.c index ceaaa551f5..5e81efb671 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -45,10 +45,14 @@ along with this program. If not, see . int tp_buttons; -#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) +#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) int retro_tapping_counter = 0; #endif +#if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) && !defined(NO_ACTION_TAPPING) +# include "process_auto_shift.h" +#endif + #ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY __attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { return false; } #endif @@ -69,7 +73,7 @@ void action_exec(keyevent_t event) { dprint("EVENT: "); debug_event(event); dprintln(); -#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) +#if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) || (defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT)) retro_tapping_counter++; #endif } @@ -106,6 +110,11 @@ void action_exec(keyevent_t event) { #endif #ifndef NO_ACTION_TAPPING +# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) + if (event.pressed) { + retroshift_poll_time(&event); + } +# endif if (IS_NOEVENT(record.event) || pre_process_record_quantum(&record)) { action_tapping_process(record); } @@ -730,7 +739,7 @@ void process_action(keyrecord_t *record, action_t action) { #endif #ifndef NO_ACTION_TAPPING -# if defined(RETRO_TAPPING) || defined(RETRO_TAPPING_PER_KEY) +# 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 { @@ -747,7 +756,11 @@ void process_action(keyrecord_t *record, action_t action) { get_retro_tapping(get_event_keycode(record->event, false), record) && # endif retro_tapping_counter == 2) { +# if defined(AUTO_SHIFT_ENABLE) && defined(RETRO_SHIFT) + process_auto_shift(action.layer_tap.code, record); +# else tap_code(action.layer_tap.code); +# endif } retro_tapping_counter = 0; } -- cgit v1.2.3