diff options
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r-- | tmk_core/common/action.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index e5e9e27052..3b1268dc94 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -98,6 +98,11 @@ void action_exec(keyevent_t event) { if (has_oneshot_mods_timed_out()) { clear_oneshot_mods(); } +# ifdef SWAP_HANDS_ENABLE + if (has_oneshot_swaphands_timed_out()) { + clear_oneshot_swaphands(); + } +# endif # endif #endif @@ -165,6 +170,8 @@ void process_record_tap_hint(keyrecord_t *record) { # ifdef SWAP_HANDS_ENABLE case ACT_SWAP_HANDS: switch (action.swap.code) { + case OP_SH_ONESHOT: + break; case OP_SH_TAP_TOGGLE: default: swap_hands = !swap_hands; @@ -224,7 +231,11 @@ void process_action(keyrecord_t *record, action_t action) { #ifndef NO_ACTION_ONESHOT bool do_release_oneshot = false; // notice we only clear the one shot layer if the pressed key is not a modifier. - if (is_oneshot_layer_active() && event.pressed && !IS_MOD(action.key.code)) { + if (is_oneshot_layer_active() && event.pressed && !IS_MOD(action.key.code) +# ifdef SWAP_HANDS_ENABLE + && !(action.kind.id == ACT_SWAP_HANDS && action.swap.code == OP_SH_ONESHOT) +# endif + ) { clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); do_release_oneshot = !is_oneshot_layer_active(); } @@ -593,6 +604,14 @@ void process_action(keyrecord_t *record, action_t action) { swap_hands = false; } break; + case OP_SH_ONESHOT: + if (event.pressed) { + set_oneshot_swaphands(); + } else { + release_oneshot_swaphands(); + } + break; + # ifndef NO_ACTION_TAPPING case OP_SH_TAP_TOGGLE: /* tap toggle */ @@ -681,6 +700,12 @@ void process_action(keyrecord_t *record, action_t action) { # endif #endif +#ifdef SWAP_HANDS_ENABLE + if (event.pressed && !(action.kind.id == ACT_SWAP_HANDS && action.swap.code == OP_SH_ONESHOT)) { + use_oneshot_swaphands(); + } +#endif + #ifndef NO_ACTION_ONESHOT /* Because we switch layers after a oneshot event, we need to release the * key before we leave the layer or no key up event will be generated. |