diff options
author | Drashna Jaelre <[email protected]> | 2023-02-18 17:08:03 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2023-02-19 12:08:03 +1100 |
commit | 48a79b08ccbcd0af5269e2e9334042c8347d18f8 (patch) | |
tree | 8f1f3c05d20ac48d57f7acce2c69864239faa47b /quantum/action.c | |
parent | 8f036574910177177cdd4e3cf5b48319b094c915 (diff) | |
download | qmk_firmware-48a79b08ccbcd0af5269e2e9334042c8347d18f8.tar.gz qmk_firmware-48a79b08ccbcd0af5269e2e9334042c8347d18f8.zip |
Fix functions when `NO_ACTION_TAPPING` is defined (#11528)
Diffstat (limited to 'quantum/action.c')
-rw-r--r-- | quantum/action.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/quantum/action.c b/quantum/action.c index d2e54bf8ec..7d3f40a950 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -399,9 +399,9 @@ void process_action(keyrecord_t *record, action_t action) { } } } break; -#ifndef NO_ACTION_TAPPING case ACT_LMODS_TAP: case ACT_RMODS_TAP: { +#ifndef NO_ACTION_TAPPING uint8_t mods = (action.kind.id == ACT_LMODS_TAP) ? action.key.mods : action.key.mods << 4; switch (action.layer_tap.code) { # ifndef NO_ACTION_ONESHOT @@ -523,8 +523,8 @@ void process_action(keyrecord_t *record, action_t action) { } break; } +#endif // NO_ACTION_TAPPING } break; -#endif #ifdef EXTRAKEY_ENABLE /* other HID usage */ case ACT_USAGE: @@ -537,7 +537,7 @@ void process_action(keyrecord_t *record, action_t action) { break; } break; -#endif +#endif // EXTRAKEY_ENABLE /* Mouse key */ case ACT_MOUSEKEY: register_mouse(action.key.code, event.pressed); @@ -597,10 +597,10 @@ void process_action(keyrecord_t *record, action_t action) { layer_off(action.layer_mods.layer); } break; -# ifndef NO_ACTION_TAPPING case ACT_LAYER_TAP: case ACT_LAYER_TAP_EXT: switch (action.layer_tap.code) { +# ifndef NO_ACTION_TAPPING case OP_TAP_TOGGLE: /* tap toggle */ if (event.pressed) { @@ -613,6 +613,7 @@ void process_action(keyrecord_t *record, action_t action) { } } break; +# endif case OP_ON_OFF: event.pressed ? layer_on(action.layer_tap.val) : layer_off(action.layer_tap.val); break; @@ -622,7 +623,7 @@ void process_action(keyrecord_t *record, action_t action) { case OP_SET_CLEAR: event.pressed ? layer_move(action.layer_tap.val) : layer_clear(); break; -# ifndef NO_ACTION_ONESHOT +# if !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING) case OP_ONESHOT: // Oneshot modifier if (!keymap_config.oneshot_enable) { @@ -632,7 +633,7 @@ void process_action(keyrecord_t *record, action_t action) { layer_off(action.layer_tap.val); } } else { -# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1 +# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1 do_release_oneshot = false; if (event.pressed) { if (get_oneshot_layer_state() == ONESHOT_TOGGLED) { @@ -651,7 +652,7 @@ void process_action(keyrecord_t *record, action_t action) { clear_oneshot_layer_state(ONESHOT_PRESSED); } } -# else +# else if (event.pressed) { layer_on(action.layer_tap.val); set_oneshot_layer(action.layer_tap.val, ONESHOT_START); @@ -661,12 +662,18 @@ void process_action(keyrecord_t *record, action_t action) { clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); } } -# endif +# endif + } +# else // NO_ACTION_ONESHOT && NO_ACTION_TAPPING + if (event.pressed) { + layer_on(action.layer_tap.val); + } else { + layer_off(action.layer_tap.val); } +# endif // !defined(NO_ACTION_ONESHOT) && !defined(NO_ACTION_TAPPING) break; -# endif default: - /* tap key */ +# ifndef NO_ACTION_TAPPING /* tap key */ if (event.pressed) { if (tap_count > 0) { ac_dprintf("KEYMAP_TAP_KEY: Tap: register_code\n"); @@ -689,11 +696,24 @@ void process_action(keyrecord_t *record, action_t action) { layer_off(action.layer_tap.val); } } +# else + if (event.pressed) { + ac_dprintf("KEYMAP_TAP_KEY: Tap: register_code\n"); + register_code(action.layer_tap.code); + } else { + ac_dprintf("KEYMAP_TAP_KEY: Tap: unregister_code\n"); + if (action.layer_tap.code == KC_CAPS) { + wait_ms(TAP_HOLD_CAPS_DELAY); + } else { + wait_ms(TAP_CODE_DELAY); + } + unregister_code(action.layer_tap.code); + } +# endif break; } break; -# endif -#endif +#endif // NO_ACTION_LAYER #ifdef SWAP_HANDS_ENABLE case ACT_SWAP_HANDS: |