summaryrefslogtreecommitdiffstats
path: root/quantum/action.c
diff options
context:
space:
mode:
authorKasimir Pihlasviita <kasimir@pihlasviita.fi>2023-04-03 08:38:44 +0300
committerGitHub <noreply@github.com>2023-04-03 15:38:44 +1000
commit46844347c4f4b5f8b50ea22dd06c7555a86fc94b (patch)
treec2e331ae9c46e9dc2764a0992fe3fa9f0b083104 /quantum/action.c
parent1899793f27c9b165b55b28b086bd989f12baf137 (diff)
Fix OSMs getting stuck (#20034)
Diffstat (limited to 'quantum/action.c')
-rw-r--r--quantum/action.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/quantum/action.c b/quantum/action.c
index 21fa98dc54..41686b5a5e 100644
--- a/quantum/action.c
+++ b/quantum/action.c
@@ -435,39 +435,32 @@ void process_action(keyrecord_t *record, action_t action) {
} else {
if (event.pressed) {
if (tap_count == 0) {
+ // Not a tap, but a hold: register the held mod
ac_dprintf("MODS_TAP: Oneshot: 0\n");
- register_mods(mods | get_oneshot_mods());
+ register_mods(mods);
} else if (tap_count == 1) {
ac_dprintf("MODS_TAP: Oneshot: start\n");
- set_oneshot_mods(mods | get_oneshot_mods());
+ add_oneshot_mods(mods);
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
ac_dprintf("MODS_TAP: Toggling oneshot");
register_mods(mods);
- clear_oneshot_mods();
- set_oneshot_locked_mods(mods | get_oneshot_locked_mods());
+ del_oneshot_mods(mods);
+ add_oneshot_locked_mods(mods);
# endif
- } else {
- register_mods(mods | get_oneshot_mods());
}
} else {
if (tap_count == 0) {
- clear_oneshot_mods();
+ // Release hold: unregister the held mod and its variants
unregister_mods(mods);
- } else if (tap_count == 1) {
- // Retain Oneshot mods
+ del_oneshot_mods(mods);
+ del_oneshot_locked_mods(mods);
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
- if (mods & get_mods()) {
- unregister_mods(mods);
- clear_oneshot_mods();
- set_oneshot_locked_mods(~mods & get_oneshot_locked_mods());
- }
- } else if (tap_count == ONESHOT_TAP_TOGGLE) {
- // Toggle Oneshot Layer
-# endif
- } else {
+ } else if (tap_count == 1 && (mods & get_mods())) {
unregister_mods(mods);
- clear_oneshot_mods();
+ del_oneshot_mods(mods);
+ del_oneshot_locked_mods(mods);
+# endif
}
}
}