aboutsummaryrefslogtreecommitdiffstats
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-07-06 23:00:05 -0500
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-07-06 21:00:05 -0700
commitd16db6936715a98b6ae769463d5ccafab25b7203 (patch)
treeffb87385b4126a69b85de1074463b8045ea716d5 /quantum/process_keycode
parenta07da6e2452cd17699a01530f5435272ab6a732f (diff)
downloadfirmware-d16db6936715a98b6ae769463d5ccafab25b7203.tar.gz
firmware-d16db6936715a98b6ae769463d5ccafab25b7203.tar.bz2
firmware-d16db6936715a98b6ae769463d5ccafab25b7203.zip
Added mod carry over from press to release. (#5866)
Update docs/feature_space_cadet.md Co-Authored-By: fauxpark <fauxpark@gmail.com>
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_space_cadet.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c
index 089199eee..c8721d446 100644
--- a/quantum/process_keycode/process_space_cadet.c
+++ b/quantum/process_keycode/process_space_cadet.c
@@ -81,11 +81,17 @@
static uint8_t sc_last = 0;
static uint16_t sc_timer = 0;
+#ifdef SPACE_CADET_MODIFIER_CARRYOVER
+static uint8_t sc_mods = 0;
+#endif
void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, uint8_t keycode) {
if (record->event.pressed) {
sc_last = holdMod;
sc_timer = timer_read ();
+#ifdef SPACE_CADET_MODIFIER_CARRYOVER
+ sc_mods = get_mods();
+#endif
if (IS_MOD(holdMod)) {
register_mods(MOD_BIT(holdMod));
}
@@ -100,7 +106,13 @@ void perform_space_cadet(keyrecord_t *record, uint8_t holdMod, uint8_t tapMod, u
register_mods(MOD_BIT(tapMod));
}
}
+#ifdef SPACE_CADET_MODIFIER_CARRYOVER
+ set_weak_mods(sc_mods);
+#endif
tap_code(keycode);
+#ifdef SPACE_CADET_MODIFIER_CARRYOVER
+ clear_weak_mods();
+#endif
if (IS_MOD(tapMod)) {
unregister_mods(MOD_BIT(tapMod));
}