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 | |
| parent | 2ffdec5dc2a5cb350998168e76d7916e2d9728fc (diff) | |
Tidy up use of keycode range helpers (#19756)
| -rw-r--r-- | keyboards/converter/usb_usb/custom_matrix.cpp | 4 | ||||
| -rw-r--r-- | keyboards/idobao/id75/keymaps/gkbd_orthon/keymap.c | 2 | ||||
| -rw-r--r-- | keyboards/sirius/unigo66/custom_matrix.cpp | 4 | ||||
| -rw-r--r-- | keyboards/xiudi/xd75/keymaps/xo/keymap.c | 2 | ||||
| -rw-r--r-- | lib/python/qmk/cli/generate/keycodes.py | 10 | ||||
| -rw-r--r-- | quantum/action.c | 18 | ||||
| -rw-r--r-- | quantum/action_tapping.c | 4 | ||||
| -rw-r--r-- | quantum/keycode.h | 2 | ||||
| -rw-r--r-- | quantum/keycodes.h | 2 | ||||
| -rw-r--r-- | quantum/process_keycode/process_combo.h | 2 | ||||
| -rw-r--r-- | quantum/process_keycode/process_key_override.c | 2 | ||||
| -rw-r--r-- | quantum/process_keycode/process_space_cadet.c | 10 | ||||
| -rw-r--r-- | quantum/quantum.c | 4 | ||||
| -rw-r--r-- | tests/test_common/keyboard_report_util.cpp | 2 | ||||
| -rw-r--r-- | users/twschum/xtonhasvim.c | 2 | ||||
| -rw-r--r-- | users/xtonhasvim/xtonhasvim.c | 2 |
16 files changed, 39 insertions, 33 deletions
diff --git a/keyboards/converter/usb_usb/custom_matrix.cpp b/keyboards/converter/usb_usb/custom_matrix.cpp index e94b6b07fb..8b5fd4451a 100644 --- a/keyboards/converter/usb_usb/custom_matrix.cpp +++ b/keyboards/converter/usb_usb/custom_matrix.cpp | |||
| @@ -189,7 +189,7 @@ extern "C" { | |||
| 189 | bool matrix_is_on(uint8_t row, uint8_t col) { | 189 | bool matrix_is_on(uint8_t row, uint8_t col) { |
| 190 | uint8_t code = CODE(row, col); | 190 | uint8_t code = CODE(row, col); |
| 191 | 191 | ||
| 192 | if (IS_MOD(code)) { | 192 | if (IS_MODIFIER_KEYCODE(code)) { |
| 193 | if (local_keyboard_report.mods & ROW_BITS(code)) { | 193 | if (local_keyboard_report.mods & ROW_BITS(code)) { |
| 194 | return true; | 194 | return true; |
| 195 | } | 195 | } |
| @@ -205,7 +205,7 @@ extern "C" { | |||
| 205 | matrix_row_t matrix_get_row(uint8_t row) { | 205 | matrix_row_t matrix_get_row(uint8_t row) { |
| 206 | uint16_t row_bits = 0; | 206 | uint16_t row_bits = 0; |
| 207 | 207 | ||
| 208 | if (IS_MOD(CODE(row, 0)) && local_keyboard_report.mods) { | 208 | if (IS_MODIFIER_KEYCODE(CODE(row, 0)) && local_keyboard_report.mods) { |
| 209 | row_bits |= local_keyboard_report.mods; | 209 | row_bits |= local_keyboard_report.mods; |
| 210 | } | 210 | } |
| 211 | 211 | ||
diff --git a/keyboards/idobao/id75/keymaps/gkbd_orthon/keymap.c b/keyboards/idobao/id75/keymaps/gkbd_orthon/keymap.c index 4e44819125..462bb3feee 100644 --- a/keyboards/idobao/id75/keymaps/gkbd_orthon/keymap.c +++ b/keyboards/idobao/id75/keymaps/gkbd_orthon/keymap.c | |||
| @@ -47,7 +47,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 47 | } | 47 | } |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | if (!IS_MOD(keycode) && record->event.pressed) { | 50 | if (!IS_MODIFIER_KEYCODE(keycode) && record->event.pressed) { |
| 51 | if(keycode == KC_E || keycode == KC_A || keycode == KC_O || keycode == KC_I || keycode == KC_U) { | 51 | if(keycode == KC_E || keycode == KC_A || keycode == KC_O || keycode == KC_I || keycode == KC_U) { |
| 52 | predecessor_key = KC_O; | 52 | predecessor_key = KC_O; |
| 53 | vowel_proximity = timer_read(); | 53 | vowel_proximity = timer_read(); |
diff --git a/keyboards/sirius/unigo66/custom_matrix.cpp b/keyboards/sirius/unigo66/custom_matrix.cpp index 15b30c8177..07c6df2981 100644 --- a/keyboards/sirius/unigo66/custom_matrix.cpp +++ b/keyboards/sirius/unigo66/custom_matrix.cpp | |||
| @@ -175,7 +175,7 @@ extern "C" | |||
| 175 | bool matrix_is_on(uint8_t row, uint8_t col) { | 175 | bool matrix_is_on(uint8_t row, uint8_t col) { |
| 176 | uint8_t code = CODE(row, col); | 176 | uint8_t code = CODE(row, col); |
| 177 | 177 | ||
| 178 | if (IS_MOD(code)) { | 178 | if (IS_MODIFIER_KEYCODE(code)) { |
| 179 | if (local_keyboard_report.mods & ROW_BITS(code)) { | 179 | if (local_keyboard_report.mods & ROW_BITS(code)) { |
| 180 | return true; | 180 | return true; |
| 181 | } | 181 | } |
| @@ -191,7 +191,7 @@ extern "C" | |||
| 191 | matrix_row_t matrix_get_row(uint8_t row) { | 191 | matrix_row_t matrix_get_row(uint8_t row) { |
| 192 | uint16_t row_bits = 0; | 192 | uint16_t row_bits = 0; |
| 193 | 193 | ||
| 194 | if (IS_MOD(CODE(row, 0)) && local_keyboard_report.mods) { | 194 | if (IS_MODIFIER_KEYCODE(CODE(row, 0)) && local_keyboard_report.mods) { |
| 195 | row_bits |= local_keyboard_report.mods; | 195 | row_bits |= local_keyboard_report.mods; |
| 196 | } | 196 | } |
| 197 | 197 | ||
diff --git a/keyboards/xiudi/xd75/keymaps/xo/keymap.c b/keyboards/xiudi/xd75/keymaps/xo/keymap.c index ca3d4cff54..8fa1f9feaa 100644 --- a/keyboards/xiudi/xd75/keymaps/xo/keymap.c +++ b/keyboards/xiudi/xd75/keymaps/xo/keymap.c | |||
| @@ -45,7 +45,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 45 | backlight_level(6); | 45 | backlight_level(6); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | if (IS_MOD(keycode)) { | 48 | if (IS_MODIFIER_KEYCODE(keycode)) { |
| 49 | if (record->event.pressed) { | 49 | if (record->event.pressed) { |
| 50 | rgblight_setrgb(RGB_RED); | 50 | rgblight_setrgb(RGB_RED); |
| 51 | } else { | 51 | } else { |
diff --git a/lib/python/qmk/cli/generate/keycodes.py b/lib/python/qmk/cli/generate/keycodes.py index 2ed84cd589..f5c646e0ea 100644 --- a/lib/python/qmk/cli/generate/keycodes.py +++ b/lib/python/qmk/cli/generate/keycodes.py | |||
| @@ -8,6 +8,14 @@ from qmk.path import normpath | |||
| 8 | from qmk.keycodes import load_spec | 8 | from qmk.keycodes import load_spec |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | def _translate_group(group): | ||
| 12 | """Fix up any issues with badly chosen values | ||
| 13 | """ | ||
| 14 | if group == 'modifiers': | ||
| 15 | return 'modifier' | ||
| 16 | return group | ||
| 17 | |||
| 18 | |||
| 11 | def _render_key(key): | 19 | def _render_key(key): |
| 12 | width = 7 | 20 | width = 7 |
| 13 | if 'S(' in key: | 21 | if 'S(' in key: |
| @@ -82,7 +90,7 @@ def _generate_helpers(lines, keycodes): | |||
| 82 | for group, codes in temp.items(): | 90 | for group, codes in temp.items(): |
| 83 | lo = keycodes["keycodes"][f'0x{codes[0]:04X}']['key'] | 91 | lo = keycodes["keycodes"][f'0x{codes[0]:04X}']['key'] |
| 84 | hi = keycodes["keycodes"][f'0x{codes[1]:04X}']['key'] | 92 | hi = keycodes["keycodes"][f'0x{codes[1]:04X}']['key'] |
| 85 | lines.append(f'#define IS_{ group.upper() }_KEYCODE(code) ((code) >= {lo} && (code) <= {hi})') | 93 | lines.append(f'#define IS_{ _translate_group(group).upper() }_KEYCODE(code) ((code) >= {lo} && (code) <= {hi})') |
| 86 | 94 | ||
| 87 | 95 | ||
| 88 | def _generate_aliases(lines, keycodes): | 96 | def _generate_aliases(lines, keycodes): |
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 | ||
diff --git a/quantum/action_tapping.c b/quantum/action_tapping.c index 821265d399..60c7ed4973 100644 --- a/quantum/action_tapping.c +++ b/quantum/action_tapping.c | |||
| @@ -247,12 +247,12 @@ bool process_tapping(keyrecord_t *keyp) { | |||
| 247 | case ACT_LMODS: | 247 | case ACT_LMODS: |
| 248 | case ACT_RMODS: | 248 | case ACT_RMODS: |
| 249 | if (action.key.mods && !action.key.code) return false; | 249 | if (action.key.mods && !action.key.code) return false; |
| 250 | if (IS_MOD(action.key.code)) return false; | 250 | if (IS_MODIFIER_KEYCODE(action.key.code)) return false; |
| 251 | break; | 251 | break; |
| 252 | case ACT_LMODS_TAP: | 252 | case ACT_LMODS_TAP: |
| 253 | case ACT_RMODS_TAP: | 253 | case ACT_RMODS_TAP: |
| 254 | if (action.key.mods && keyp->tap.count == 0) return false; | 254 | if (action.key.mods && keyp->tap.count == 0) return false; |
| 255 | if (IS_MOD(action.key.code)) return false; | 255 | if (IS_MODIFIER_KEYCODE(action.key.code)) return false; |
| 256 | break; | 256 | break; |
| 257 | case ACT_LAYER_TAP: | 257 | case ACT_LAYER_TAP: |
| 258 | case ACT_LAYER_TAP_EXT: | 258 | case ACT_LAYER_TAP_EXT: |
diff --git a/quantum/keycode.h b/quantum/keycode.h index 45736e92f1..03989ed8f6 100644 --- a/quantum/keycode.h +++ b/quantum/keycode.h | |||
| @@ -27,8 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 27 | /* FIXME: Add doxygen comments here */ | 27 | /* FIXME: Add doxygen comments here */ |
| 28 | 28 | ||
| 29 | #define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF) | 29 | #define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF) |
| 30 | #define IS_KEY(code) IS_BASIC_KEYCODE(code) | ||
| 31 | #define IS_MOD(code) IS_MODIFIERS_KEYCODE(code) | ||
| 32 | 30 | ||
| 33 | #define IS_SYSTEM(code) IS_SYSTEM_KEYCODE(code) | 31 | #define IS_SYSTEM(code) IS_SYSTEM_KEYCODE(code) |
| 34 | #define IS_CONSUMER(code) IS_MEDIA_KEYCODE(code) | 32 | #define IS_CONSUMER(code) IS_MEDIA_KEYCODE(code) |
diff --git a/quantum/keycodes.h b/quantum/keycodes.h index 96f352a2c1..f24ccf01b8 100644 --- a/quantum/keycodes.h +++ b/quantum/keycodes.h | |||
| @@ -1321,7 +1321,7 @@ enum qk_keycode_defines { | |||
| 1321 | #define IS_SYSTEM_KEYCODE(code) ((code) >= KC_SYSTEM_POWER && (code) <= KC_SYSTEM_WAKE) | 1321 | #define IS_SYSTEM_KEYCODE(code) ((code) >= KC_SYSTEM_POWER && (code) <= KC_SYSTEM_WAKE) |
| 1322 | #define IS_MEDIA_KEYCODE(code) ((code) >= KC_AUDIO_MUTE && (code) <= KC_ASSISTANT) | 1322 | #define IS_MEDIA_KEYCODE(code) ((code) >= KC_AUDIO_MUTE && (code) <= KC_ASSISTANT) |
| 1323 | #define IS_MOUSE_KEYCODE(code) ((code) >= KC_MS_UP && (code) <= KC_MS_ACCEL2) | 1323 | #define IS_MOUSE_KEYCODE(code) ((code) >= KC_MS_UP && (code) <= KC_MS_ACCEL2) |
| 1324 | #define IS_MODIFIERS_KEYCODE(code) ((code) >= KC_LEFT_CTRL && (code) <= KC_RIGHT_GUI) | 1324 | #define IS_MODIFIER_KEYCODE(code) ((code) >= KC_LEFT_CTRL && (code) <= KC_RIGHT_GUI) |
| 1325 | #define IS_SWAP_HANDS_KEYCODE(code) ((code) >= QK_SWAP_HANDS_TOGGLE && (code) <= QK_SWAP_HANDS_ONE_SHOT) | 1325 | #define IS_SWAP_HANDS_KEYCODE(code) ((code) >= QK_SWAP_HANDS_TOGGLE && (code) <= QK_SWAP_HANDS_ONE_SHOT) |
| 1326 | #define IS_MAGIC_KEYCODE(code) ((code) >= MAGIC_SWAP_CONTROL_CAPSLOCK && (code) <= MAGIC_TOGGLE_ESCAPE_CAPSLOCK) | 1326 | #define IS_MAGIC_KEYCODE(code) ((code) >= MAGIC_SWAP_CONTROL_CAPSLOCK && (code) <= MAGIC_TOGGLE_ESCAPE_CAPSLOCK) |
| 1327 | #define IS_MIDI_KEYCODE(code) ((code) >= QK_MIDI_ON && (code) <= QK_MIDI_PITCH_BEND_UP) | 1327 | #define IS_MIDI_KEYCODE(code) ((code) >= QK_MIDI_ON && (code) <= QK_MIDI_PITCH_BEND_UP) |
diff --git a/quantum/process_keycode/process_combo.h b/quantum/process_keycode/process_combo.h index 4c4e574e34..e430c4a5f7 100644 --- a/quantum/process_keycode/process_combo.h +++ b/quantum/process_keycode/process_combo.h | |||
| @@ -69,7 +69,7 @@ typedef struct { | |||
| 69 | #endif | 69 | #endif |
| 70 | 70 | ||
| 71 | /* check if keycode is only modifiers */ | 71 | /* check if keycode is only modifiers */ |
| 72 | #define KEYCODE_IS_MOD(code) (IS_MOD(code) || (code >= QK_MODS && code <= QK_MODS_MAX && !(code & QK_BASIC_MAX))) | 72 | #define KEYCODE_IS_MOD(code) (IS_MODIFIER_KEYCODE(code) || (IS_QK_MODS(code) && !QK_MODS_GET_BASIC_KEYCODE(code))) |
| 73 | 73 | ||
| 74 | bool process_combo(uint16_t keycode, keyrecord_t *record); | 74 | bool process_combo(uint16_t keycode, keyrecord_t *record); |
| 75 | void combo_task(void); | 75 | void combo_task(void); |
diff --git a/quantum/process_keycode/process_key_override.c b/quantum/process_keycode/process_key_override.c index 9c5abccd4f..9b91ae2223 100644 --- a/quantum/process_keycode/process_key_override.c +++ b/quantum/process_keycode/process_key_override.c | |||
| @@ -402,7 +402,7 @@ bool process_key_override(const uint16_t keycode, const keyrecord_t *const recor | |||
| 402 | #endif | 402 | #endif |
| 403 | 403 | ||
| 404 | const bool key_down = record->event.pressed; | 404 | const bool key_down = record->event.pressed; |
| 405 | const bool is_mod = IS_MOD(keycode); | 405 | const bool is_mod = IS_MODIFIER_KEYCODE(keycode); |
| 406 | 406 | ||
| 407 | if (key_down) { | 407 | if (key_down) { |
| 408 | switch (keycode) { | 408 | switch (keycode) { |
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index a62cd60a70..3109ea1711 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c | |||
| @@ -89,16 +89,16 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdM | |||
| 89 | #ifdef SPACE_CADET_MODIFIER_CARRYOVER | 89 | #ifdef SPACE_CADET_MODIFIER_CARRYOVER |
| 90 | sc_mods = get_mods(); | 90 | sc_mods = get_mods(); |
| 91 | #endif | 91 | #endif |
| 92 | if (IS_MOD(holdMod)) { | 92 | if (IS_MODIFIER_KEYCODE(holdMod)) { |
| 93 | register_mods(MOD_BIT(holdMod)); | 93 | register_mods(MOD_BIT(holdMod)); |
| 94 | } | 94 | } |
| 95 | } else { | 95 | } else { |
| 96 | if (sc_last == holdMod && timer_elapsed(sc_timer) < GET_TAPPING_TERM(sc_keycode, record)) { | 96 | if (sc_last == holdMod && timer_elapsed(sc_timer) < GET_TAPPING_TERM(sc_keycode, record)) { |
| 97 | if (holdMod != tapMod) { | 97 | if (holdMod != tapMod) { |
| 98 | if (IS_MOD(holdMod)) { | 98 | if (IS_MODIFIER_KEYCODE(holdMod)) { |
| 99 | unregister_mods(MOD_BIT(holdMod)); | 99 | unregister_mods(MOD_BIT(holdMod)); |
| 100 | } | 100 | } |
| 101 | if (IS_MOD(tapMod)) { | 101 | if (IS_MODIFIER_KEYCODE(tapMod)) { |
| 102 | register_mods(MOD_BIT(tapMod)); | 102 | register_mods(MOD_BIT(tapMod)); |
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| @@ -109,11 +109,11 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdM | |||
| 109 | #ifdef SPACE_CADET_MODIFIER_CARRYOVER | 109 | #ifdef SPACE_CADET_MODIFIER_CARRYOVER |
| 110 | clear_weak_mods(); | 110 | clear_weak_mods(); |
| 111 | #endif | 111 | #endif |
| 112 | if (IS_MOD(tapMod)) { | 112 | if (IS_MODIFIER_KEYCODE(tapMod)) { |
| 113 | unregister_mods(MOD_BIT(tapMod)); | 113 | unregister_mods(MOD_BIT(tapMod)); |
| 114 | } | 114 | } |
| 115 | } else { | 115 | } else { |
| 116 | if (IS_MOD(holdMod)) { | 116 | if (IS_MODIFIER_KEYCODE(holdMod)) { |
| 117 | unregister_mods(MOD_BIT(holdMod)); | 117 | unregister_mods(MOD_BIT(holdMod)); |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
diff --git a/quantum/quantum.c b/quantum/quantum.c index 0e69246f41..653f553f60 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -76,7 +76,7 @@ void do_code16(uint16_t code, void (*f)(uint8_t)) { | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | __attribute__((weak)) void register_code16(uint16_t code) { | 78 | __attribute__((weak)) void register_code16(uint16_t code) { |
| 79 | if (IS_MOD(code) || code == KC_NO) { | 79 | if (IS_MODIFIER_KEYCODE(code) || code == KC_NO) { |
| 80 | do_code16(code, register_mods); | 80 | do_code16(code, register_mods); |
| 81 | } else { | 81 | } else { |
| 82 | do_code16(code, register_weak_mods); | 82 | do_code16(code, register_weak_mods); |
| @@ -86,7 +86,7 @@ __attribute__((weak)) void register_code16(uint16_t code) { | |||
| 86 | 86 | ||
| 87 | __attribute__((weak)) void unregister_code16(uint16_t code) { | 87 | __attribute__((weak)) void unregister_code16(uint16_t code) { |
| 88 | unregister_code(code); | 88 | unregister_code(code); |
| 89 | if (IS_MOD(code) || code == KC_NO) { | 89 | if (IS_MODIFIER_KEYCODE(code) || code == KC_NO) { |
| 90 | do_code16(code, unregister_mods); | 90 | do_code16(code, unregister_mods); |
| 91 | } else { | 91 | } else { |
| 92 | do_code16(code, unregister_weak_mods); | 92 | do_code16(code, unregister_weak_mods); |
diff --git a/tests/test_common/keyboard_report_util.cpp b/tests/test_common/keyboard_report_util.cpp index 2de1af2301..cb7f7ae735 100644 --- a/tests/test_common/keyboard_report_util.cpp +++ b/tests/test_common/keyboard_report_util.cpp | |||
| @@ -97,7 +97,7 @@ std::ostream& operator<<(std::ostream& os, const report_keyboard_t& report) { | |||
| 97 | KeyboardReportMatcher::KeyboardReportMatcher(const std::vector<uint8_t>& keys) { | 97 | KeyboardReportMatcher::KeyboardReportMatcher(const std::vector<uint8_t>& keys) { |
| 98 | memset(m_report.raw, 0, sizeof(m_report.raw)); | 98 | memset(m_report.raw, 0, sizeof(m_report.raw)); |
| 99 | for (auto k : keys) { | 99 | for (auto k : keys) { |
| 100 | if (IS_MOD(k)) { | 100 | if (IS_MODIFIER_KEYCODE(k)) { |
| 101 | m_report.mods |= MOD_BIT(k); | 101 | m_report.mods |= MOD_BIT(k); |
| 102 | } else { | 102 | } else { |
| 103 | add_key_to_report(&m_report, k); | 103 | add_key_to_report(&m_report, k); |
diff --git a/users/twschum/xtonhasvim.c b/users/twschum/xtonhasvim.c index b3f410bc26..60f6fa1377 100644 --- a/users/twschum/xtonhasvim.c +++ b/users/twschum/xtonhasvim.c | |||
| @@ -89,7 +89,7 @@ static void comma_period(uint16_t keycode) { | |||
| 89 | bool process_record_vimlayer(uint16_t keycode, keyrecord_t *record) { | 89 | bool process_record_vimlayer(uint16_t keycode, keyrecord_t *record) { |
| 90 | 90 | ||
| 91 | /****** mod passthru *****/ | 91 | /****** mod passthru *****/ |
| 92 | if(record->event.pressed && layer_state_is(vim_cmd_layer()) && (IS_MOD(keycode) || keycode == LSFT(KC_LALT))) { | 92 | if(record->event.pressed && layer_state_is(vim_cmd_layer()) && (IS_MODIFIER_KEYCODE(keycode) || keycode == LSFT(KC_LALT))) { |
| 93 | mod_override_layer_state = layer_state; | 93 | mod_override_layer_state = layer_state; |
| 94 | mod_override_triggering_key = keycode; | 94 | mod_override_triggering_key = keycode; |
| 95 | // TODO: change this to track key location instead | 95 | // TODO: change this to track key location instead |
diff --git a/users/xtonhasvim/xtonhasvim.c b/users/xtonhasvim/xtonhasvim.c index 2d59cf2c62..a33dc68cad 100644 --- a/users/xtonhasvim/xtonhasvim.c +++ b/users/xtonhasvim/xtonhasvim.c | |||
| @@ -139,7 +139,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | /****** mod passthru *****/ | 141 | /****** mod passthru *****/ |
| 142 | if(record->event.pressed && layer_state_is(vim_cmd_layer()) && (IS_MOD(keycode) || keycode == LSFT(KC_LALT))) { | 142 | if(record->event.pressed && layer_state_is(vim_cmd_layer()) && (IS_MODIFIER_KEYCODE(keycode) || keycode == LSFT(KC_LALT))) { |
| 143 | mod_override_layer_state = layer_state; | 143 | mod_override_layer_state = layer_state; |
| 144 | mod_override_triggering_key = keycode; | 144 | mod_override_triggering_key = keycode; |
| 145 | // TODO: change this to track key location instead | 145 | // TODO: change this to track key location instead |
