summaryrefslogtreecommitdiff
path: root/quantum/action.c
diff options
context:
space:
mode:
authorIsaac Elenbaas <isaacelenbaas@gmail.com>2021-11-25 07:12:14 -0500
committerGitHub <noreply@github.com>2021-11-25 23:12:14 +1100
commitd9393b86842b7ef143259b5f771ae7969f98cbb4 (patch)
treee0760c20f65c4cac7b6ffb3fedf3f36c6f7c13a2 /quantum/action.c
parent282e916d86a5d353b7cbdfef3afad3c7b011eb14 (diff)
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
Diffstat (limited to 'quantum/action.c')
-rw-r--r--quantum/action.c19
1 files changed, 16 insertions, 3 deletions
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 <http://www.gnu.org/licenses/>.
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;
}