Extend allowed range of tappable keycodes to include modifiers (#5809)
* Extend allowed range of tappable keycodes to include modifiers * Get rid of the magic numbers altogether * Remove some more magic numbers * Extract LM() functionality from ACT_LAYER_TAP * Use ACTION() macro everywhere
This commit is contained in:
parent
2a534e87ac
commit
2f6c068e0d
2 changed files with 25 additions and 16 deletions
|
@ -437,20 +437,19 @@ void process_action(keyrecord_t *record, action_t action)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case ACT_LAYER_MODS:
|
||||
if (event.pressed) {
|
||||
layer_on(action.layer_mods.layer);
|
||||
register_mods(action.layer_mods.mods);
|
||||
} else {
|
||||
unregister_mods(action.layer_mods.mods);
|
||||
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) {
|
||||
case 0xe0 ... 0xef:
|
||||
/* layer On/Off with modifiers(left only) */
|
||||
if (event.pressed) {
|
||||
layer_on(action.layer_tap.val);
|
||||
register_mods(action.layer_tap.code & 0x0f);
|
||||
} else {
|
||||
layer_off(action.layer_tap.val);
|
||||
unregister_mods(action.layer_tap.code & 0x0f);
|
||||
}
|
||||
break;
|
||||
case OP_TAP_TOGGLE:
|
||||
/* tap toggle */
|
||||
if (event.pressed) {
|
||||
|
@ -652,6 +651,7 @@ void process_action(keyrecord_t *record, action_t action)
|
|||
// if this event is a layer action, update the leds
|
||||
switch (action.kind.id) {
|
||||
case ACT_LAYER:
|
||||
case ACT_LAYER_MODS:
|
||||
#ifndef NO_ACTION_TAPPING
|
||||
case ACT_LAYER_TAP:
|
||||
case ACT_LAYER_TAP_EXT:
|
||||
|
@ -957,7 +957,7 @@ bool is_tap_action(action_t action)
|
|||
case ACT_LAYER_TAP:
|
||||
case ACT_LAYER_TAP_EXT:
|
||||
switch (action.layer_tap.code) {
|
||||
case 0x00 ... 0xdf:
|
||||
case KC_NO ... KC_RGUI:
|
||||
case OP_TAP_TOGGLE:
|
||||
case OP_ONESHOT:
|
||||
return true;
|
||||
|
@ -965,7 +965,7 @@ bool is_tap_action(action_t action)
|
|||
return false;
|
||||
case ACT_SWAP_HANDS:
|
||||
switch (action.swap.code) {
|
||||
case 0x00 ... 0xdf:
|
||||
case KC_NO ... KC_RGUI:
|
||||
case OP_SH_TAP_TOGGLE:
|
||||
return true;
|
||||
}
|
||||
|
@ -1014,6 +1014,7 @@ void debug_action(action_t action)
|
|||
case ACT_USAGE: dprint("ACT_USAGE"); break;
|
||||
case ACT_MOUSEKEY: dprint("ACT_MOUSEKEY"); break;
|
||||
case ACT_LAYER: dprint("ACT_LAYER"); break;
|
||||
case ACT_LAYER_MODS: dprint("ACT_LAYER_MODS"); break;
|
||||
case ACT_LAYER_TAP: dprint("ACT_LAYER_TAP"); break;
|
||||
case ACT_LAYER_TAP_EXT: dprint("ACT_LAYER_TAP_EXT"); break;
|
||||
case ACT_MACRO: dprint("ACT_MACRO"); break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue