summaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_caps_word.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/process_keycode/process_caps_word.c')
-rw-r--r--quantum/process_keycode/process_caps_word.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/quantum/process_keycode/process_caps_word.c b/quantum/process_keycode/process_caps_word.c
index 1b9583196d..4c0217eba7 100644
--- a/quantum/process_keycode/process_caps_word.c
+++ b/quantum/process_keycode/process_caps_word.c
@@ -15,7 +15,7 @@
#include "process_caps_word.h"
bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
- if (keycode == CAPSWRD) { // Pressing CAPSWRD toggles Caps Word.
+ if (keycode == QK_CAPS_WORD_TOGGLE) {
if (record->event.pressed) {
caps_word_toggle();
}
@@ -109,7 +109,7 @@ bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
// * Otherwise stop Caps Word.
case QK_MOD_TAP ... QK_MOD_TAP_MAX:
if (record->tap.count == 0) { // Mod-tap key is held.
- const uint8_t mods = (keycode >> 8) & 0x1f;
+ const uint8_t mods = QK_MOD_TAP_GET_MODS(keycode);
switch (mods) {
case MOD_LSFT:
keycode = KC_LSFT;
@@ -127,7 +127,7 @@ bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
return true;
}
} else {
- keycode &= 0xff;
+ keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
}
break;
@@ -137,16 +137,18 @@ bool process_caps_word(uint16_t keycode, keyrecord_t* record) {
if (record->tap.count == 0) {
return true;
}
- keycode &= 0xff;
+ keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
break;
#endif // NO_ACTION_TAPPING
#ifdef SWAP_HANDS_ENABLE
case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX:
- if (keycode > 0x56F0 || record->tap.count == 0) {
+ // Note: IS_SWAP_HANDS_KEYCODE() actually tests for the special action keycodes like SH_TG, SH_TT, ...,
+ // which currently overlap the SH_T(kc) range.
+ if (IS_SWAP_HANDS_KEYCODE(keycode) || record->tap.count == 0) {
return true;
}
- keycode &= 0xff;
+ keycode = QK_SWAP_HANDS_GET_TAP_KEYCODE(keycode);
break;
#endif // SWAP_HANDS_ENABLE
}