diff options
| author | Joel Challis <git@zvecr.com> | 2023-02-10 21:10:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-10 21:10:14 +0000 |
| commit | 1d0b4c8d38794dc019ecb224f2992b4ddfa70839 (patch) | |
| tree | 48e0423bcafbb2fa680c7bc5199aba8794665339 /quantum/action.c | |
| parent | 2ffdec5dc2a5cb350998168e76d7916e2d9728fc (diff) | |
Tidy up use of keycode range helpers (#19756)
Diffstat (limited to 'quantum/action.c')
| -rw-r--r-- | quantum/action.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/quantum/action.c b/quantum/action.c index 6b5660af8b..72f132eaa8 100644 --- a/quantum/action.c +++ b/quantum/action.c | |||
| @@ -351,7 +351,7 @@ void process_action(keyrecord_t *record, action_t action) { | |||
| 351 | bool do_release_oneshot = false; | 351 | bool do_release_oneshot = false; |
| 352 | // notice we only clear the one shot layer if the pressed key is not a modifier. | 352 | // notice we only clear the one shot layer if the pressed key is not a modifier. |
| 353 | if (is_oneshot_layer_active() && event.pressed && | 353 | if (is_oneshot_layer_active() && event.pressed && |
| 354 | (action.kind.id == ACT_USAGE || !(IS_MOD(action.key.code) | 354 | (action.kind.id == ACT_USAGE || !(IS_MODIFIER_KEYCODE(action.key.code) |
| 355 | # ifndef NO_ACTION_TAPPING | 355 | # ifndef NO_ACTION_TAPPING |
| 356 | || (tap_count == 0 && (action.kind.id == ACT_LMODS_TAP || action.kind.id == ACT_RMODS_TAP)) | 356 | || (tap_count == 0 && (action.kind.id == ACT_LMODS_TAP || action.kind.id == ACT_RMODS_TAP)) |
| 357 | # endif | 357 | # endif |
| @@ -372,7 +372,7 @@ void process_action(keyrecord_t *record, action_t action) { | |||
| 372 | uint8_t mods = (action.kind.id == ACT_LMODS) ? action.key.mods : action.key.mods << 4; | 372 | uint8_t mods = (action.kind.id == ACT_LMODS) ? action.key.mods : action.key.mods << 4; |
| 373 | if (event.pressed) { | 373 | if (event.pressed) { |
| 374 | if (mods) { | 374 | if (mods) { |
| 375 | if (IS_MOD(action.key.code) || action.key.code == KC_NO) { | 375 | if (IS_MODIFIER_KEYCODE(action.key.code) || action.key.code == KC_NO) { |
| 376 | // e.g. LSFT(KC_LEFT_GUI): we don't want the LSFT to be weak as it would make it useless. | 376 | // e.g. LSFT(KC_LEFT_GUI): we don't want the LSFT to be weak as it would make it useless. |
| 377 | // This also makes LSFT(KC_LEFT_GUI) behave exactly the same as LGUI(KC_LEFT_SHIFT). | 377 | // This also makes LSFT(KC_LEFT_GUI) behave exactly the same as LGUI(KC_LEFT_SHIFT). |
| 378 | // Same applies for some keys like KC_MEH which are declared as MEH(KC_NO). | 378 | // Same applies for some keys like KC_MEH which are declared as MEH(KC_NO). |
| @@ -386,7 +386,7 @@ void process_action(keyrecord_t *record, action_t action) { | |||
| 386 | } else { | 386 | } else { |
| 387 | unregister_code(action.key.code); | 387 | unregister_code(action.key.code); |
| 388 | if (mods) { | 388 | if (mods) { |
| 389 | if (IS_MOD(action.key.code) || action.key.code == KC_NO) { | 389 | if (IS_MODIFIER_KEYCODE(action.key.code) || action.key.code == KC_NO) { |
| 390 | del_mods(mods); | 390 | del_mods(mods); |
| 391 | } else { | 391 | } else { |
| 392 | del_weak_mods(mods); | 392 | del_weak_mods(mods); |
| @@ -406,7 +406,7 @@ void process_action(keyrecord_t *record, action_t action) { | |||
| 406 | if (!keymap_config.oneshot_enable) { | 406 | if (!keymap_config.oneshot_enable) { |
| 407 | if (event.pressed) { | 407 | if (event.pressed) { |
| 408 | if (mods) { | 408 | if (mods) { |
| 409 | if (IS_MOD(action.key.code) || action.key.code == KC_NO) { | 409 | if (IS_MODIFIER_KEYCODE(action.key.code) || action.key.code == KC_NO) { |
| 410 | // e.g. LSFT(KC_LGUI): we don't want the LSFT to be weak as it would make it useless. | 410 | // e.g. LSFT(KC_LGUI): we don't want the LSFT to be weak as it would make it useless. |
| 411 | // This also makes LSFT(KC_LGUI) behave exactly the same as LGUI(KC_LSFT). | 411 | // This also makes LSFT(KC_LGUI) behave exactly the same as LGUI(KC_LSFT). |
| 412 | // Same applies for some keys like KC_MEH which are declared as MEH(KC_NO). | 412 | // Same applies for some keys like KC_MEH which are declared as MEH(KC_NO). |
| @@ -420,7 +420,7 @@ void process_action(keyrecord_t *record, action_t action) { | |||
| 420 | } else { | 420 | } else { |
| 421 | unregister_code(action.key.code); | 421 | unregister_code(action.key.code); |
| 422 | if (mods) { | 422 | if (mods) { |
| 423 | if (IS_MOD(action.key.code) || action.key.code == KC_NO) { | 423 | if (IS_MODIFIER_KEYCODE(action.key.code) || action.key.code == KC_NO) { |
| 424 | del_mods(mods); | 424 | del_mods(mods); |
| 425 | } else { | 425 | } else { |
| 426 | del_weak_mods(mods); | 426 | del_weak_mods(mods); |
| @@ -877,7 +877,7 @@ __attribute__((weak)) void register_code(uint8_t code) { | |||
| 877 | send_keyboard_report(); | 877 | send_keyboard_report(); |
| 878 | #endif | 878 | #endif |
| 879 | 879 | ||
| 880 | } else if IS_KEY (code) { | 880 | } else if IS_BASIC_KEYCODE (code) { |
| 881 | // TODO: should push command_proc out of this block? | 881 | // TODO: should push command_proc out of this block? |
| 882 | if (command_proc(code)) return; | 882 | if (command_proc(code)) return; |
| 883 | 883 | ||
| @@ -890,7 +890,7 @@ __attribute__((weak)) void register_code(uint8_t code) { | |||
| 890 | } | 890 | } |
| 891 | add_key(code); | 891 | add_key(code); |
| 892 | send_keyboard_report(); | 892 | send_keyboard_report(); |
| 893 | } else if IS_MOD (code) { | 893 | } else if IS_MODIFIER_KEYCODE (code) { |
| 894 | add_mods(MOD_BIT(code)); | 894 | add_mods(MOD_BIT(code)); |
| 895 | send_keyboard_report(); | 895 | send_keyboard_report(); |
| 896 | 896 | ||
| @@ -944,10 +944,10 @@ __attribute__((weak)) void unregister_code(uint8_t code) { | |||
| 944 | send_keyboard_report(); | 944 | send_keyboard_report(); |
| 945 | #endif | 945 | #endif |
| 946 | 946 | ||
| 947 | } else if IS_KEY (code) { | 947 | } else if IS_BASIC_KEYCODE (code) { |
| 948 | del_key(code); | 948 | del_key(code); |
| 949 | send_keyboard_report(); | 949 | send_keyboard_report(); |
| 950 | } else if IS_MOD (code) { | 950 | } else if IS_MODIFIER_KEYCODE (code) { |
| 951 | del_mods(MOD_BIT(code)); | 951 | del_mods(MOD_BIT(code)); |
| 952 | send_keyboard_report(); | 952 | send_keyboard_report(); |
| 953 | 953 | ||
