summaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2024-01-19 22:01:31 +0200
committerJustin Wernick <justin@worthe-it.co.za>2024-01-19 22:01:31 +0200
commitb11eb39511b837519bc8ef0111a9cede3b283262 (patch)
tree5e19b4bfe09c1f1b40cc0881aebf63db382e9d92 /keyboards
parentfe57dd5103efcf77f78cc8b910c55c8dcdea4687 (diff)
Fix bugs around key statesjworthe-oryx
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c b/keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c
index 60f3967c8c..8ca83cd31d 100644
--- a/keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c
+++ b/keyboards/ergodox_ez/glow/keymaps/jworthe/keymap.c
@@ -159,6 +159,9 @@ void rgb_matrix_indicators_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ int mod_state = get_mods();
+ clear_mods();
+
switch (keycode) {
case SMALL_ARROW:
if (record->event.pressed) {
@@ -172,7 +175,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case EMAIL:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("justin.worthe@gmail.com");
} else {
SEND_STRING("justin@worthe-it.co.za");
@@ -181,12 +184,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case WHILE:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("for");
} else {
SEND_STRING("while");
}
- SEND_STRING();
}
break;
case ENUM:
@@ -196,7 +198,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case BOOL:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("false");
} else {
SEND_STRING("true");
@@ -205,7 +207,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case IFELSE:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("else");
} else {
SEND_STRING("if");
@@ -214,7 +216,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case PUB:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("pub(crate)");
} else {
SEND_STRING("pub");
@@ -223,7 +225,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case ASYNC:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("await");
} else {
SEND_STRING("async");
@@ -231,15 +233,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
break;
case SELF:
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
- SEND_STRING("Self");
- } else {
- SEND_STRING("self");
+ if (record->event.pressed) {
+ if (mod_state & MOD_MASK_SHIFT) {
+ SEND_STRING("Self");
+ } else {
+ SEND_STRING("self");
+ }
}
break;
case IMPL:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("dyn");
} else {
SEND_STRING("impl");
@@ -248,7 +252,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case FN:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("function");
} else {
SEND_STRING("fn");
@@ -257,7 +261,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case LET:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("const");
} else {
SEND_STRING("let");
@@ -266,7 +270,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case BYE:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("Cheers," SS_TAP(X_ENTER) "Justin");
} else {
SEND_STRING("Kind regards," SS_TAP(X_ENTER) "Justin Wernick");
@@ -275,7 +279,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case STRUCT:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("trait");
} else {
SEND_STRING("struct");
@@ -284,7 +288,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case CRATE:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("super");
} else {
SEND_STRING("crate");
@@ -293,7 +297,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case BREAK:
if (record->event.pressed) {
- if (get_mods() == MOD_BIT(MOD_MASK_SHIFT)) {
+ if (mod_state & MOD_MASK_SHIFT) {
SEND_STRING("continue");
} else {
SEND_STRING("break");
@@ -315,8 +319,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
rgblight_mode(1);
}
- return false;
+ break;
}
+
+ set_mods(mod_state);
return true;
}