diff options
author | fauxpark <[email protected]> | 2019-08-09 06:58:05 +1000 |
---|---|---|
committer | Drashna Jaelre <[email protected]> | 2019-08-08 13:58:05 -0700 |
commit | 2f6c068e0dd7abc3cec1bb72df0b1e96032246f8 (patch) | |
tree | aa2adad462669cc0f048bf81cec331e28287df7b /tmk_core/common/action.c | |
parent | 2a534e87acfa8391d88dac6df02ae1a14da6c18e (diff) | |
download | qmk_firmware-2f6c068e0dd7abc3cec1bb72df0b1e96032246f8.tar.gz qmk_firmware-2f6c068e0dd7abc3cec1bb72df0b1e96032246f8.zip |
Extend allowed range of tappable keycodes to include modifiers (#5809)0.6.445
* 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
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r-- | tmk_core/common/action.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 5172e8650a..f47fd20fc9 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -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; |