Skip to content

Commit

Permalink
Fix functions when NO_ACTION_TAPPING is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
drashna committed Aug 13, 2022
1 parent 52dc16b commit 21d7ced
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 15 deletions.
46 changes: 33 additions & 13 deletions quantum/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,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
Expand Down Expand Up @@ -483,8 +483,8 @@ void process_action(keyrecord_t *record, action_t action) {
}
break;
}
} break;
#endif
} break;
#ifdef EXTRAKEY_ENABLE
/* other HID usage */
case ACT_USAGE:
Expand All @@ -505,7 +505,7 @@ void process_action(keyrecord_t *record, action_t action) {
break;
}
break;
#endif
#endif // EXTRAKEY_ENABLE
#ifdef MOUSEKEY_ENABLE
/* Mouse key */
case ACT_MOUSEKEY:
Expand All @@ -529,7 +529,7 @@ void process_action(keyrecord_t *record, action_t action) {
break;
}
break;
#endif
#endif // MOUSEKEY_ENABLE
#ifndef NO_ACTION_LAYER
case ACT_LAYER:
if (action.layer_bitop.on == 0) {
Expand Down Expand Up @@ -585,10 +585,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) {
Expand All @@ -601,6 +601,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;
Expand All @@ -610,7 +611,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) {
Expand All @@ -620,7 +621,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) {
Expand All @@ -639,7 +640,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);
Expand All @@ -649,12 +650,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) {
dprint("KEYMAP_TAP_KEY: Tap: register_code\n");
Expand All @@ -677,11 +684,24 @@ void process_action(keyrecord_t *record, action_t action) {
layer_off(action.layer_tap.val);
}
}
# else
if (event.pressed) {
dprint("KEYMAP_TAP_KEY: Tap: register_code\n");
register_code(action.layer_tap.code);
} else {
dprint("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:
Expand Down
4 changes: 2 additions & 2 deletions quantum/action_tapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ bool get_retro_tapping(uint16_t keycode, keyrecord_t *record);
extern uint16_t g_tapping_term;
#endif

#ifdef TAPPING_TERM_PER_KEY
#if defined(TAPPING_TERM_PER_KEY) && !defined(NO_ACTION_TAPPING)
# define GET_TAPPING_TERM(keycode, record) get_tapping_term(keycode, record)
#elif defined(DYNAMIC_TAPPING_TERM_ENABLE)
#elif defined(DYNAMIC_TAPPING_TERM_ENABLE) && !defined(NO_ACTION_TAPPING)
# define GET_TAPPING_TERM(keycode, record) g_tapping_term
#else
# define GET_TAPPING_TERM(keycode, record) (TAPPING_TERM)
Expand Down

0 comments on commit 21d7ced

Please sign in to comment.