Fix one-shot locked modifiers (#16114)
* Fix state updates of one-shot locked modifiers Activating additional one-shot locked modifiers removed previously enabled locked modifiers from the state. `get_oneshot_locked_mods` returned zero when two or more one-shot locked modifiers were enabled and then one was disabled. * Do not delete one-shot locked modifiers on a one-shot layer toggle Non-locked one-shot modifiers are not removed so this behavior adds inconsistency. Also the one-shot locked modifiers state was reset without unregistering any modifiers.
This commit is contained in:
parent
5fc8f8488f
commit
b1ceb4bb6a
@ -404,7 +404,7 @@ void process_action(keyrecord_t *record, action_t action) {
|
|||||||
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
|
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
|
||||||
dprint("MODS_TAP: Toggling oneshot");
|
dprint("MODS_TAP: Toggling oneshot");
|
||||||
clear_oneshot_mods();
|
clear_oneshot_mods();
|
||||||
set_oneshot_locked_mods(mods);
|
set_oneshot_locked_mods(mods | get_oneshot_locked_mods());
|
||||||
register_mods(mods);
|
register_mods(mods);
|
||||||
# endif
|
# endif
|
||||||
} else {
|
} else {
|
||||||
@ -418,8 +418,8 @@ void process_action(keyrecord_t *record, action_t action) {
|
|||||||
// Retain Oneshot mods
|
// Retain Oneshot mods
|
||||||
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
|
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
|
||||||
if (mods & get_mods()) {
|
if (mods & get_mods()) {
|
||||||
clear_oneshot_locked_mods();
|
|
||||||
clear_oneshot_mods();
|
clear_oneshot_mods();
|
||||||
|
set_oneshot_locked_mods(~mods & get_oneshot_locked_mods());
|
||||||
unregister_mods(mods);
|
unregister_mods(mods);
|
||||||
}
|
}
|
||||||
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
|
} else if (tap_count == ONESHOT_TAP_TOGGLE) {
|
||||||
@ -623,7 +623,6 @@ void process_action(keyrecord_t *record, action_t action) {
|
|||||||
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
|
# if defined(ONESHOT_TAP_TOGGLE) && ONESHOT_TAP_TOGGLE > 1
|
||||||
do_release_oneshot = false;
|
do_release_oneshot = false;
|
||||||
if (event.pressed) {
|
if (event.pressed) {
|
||||||
del_mods(get_oneshot_locked_mods());
|
|
||||||
if (get_oneshot_layer_state() == ONESHOT_TOGGLED) {
|
if (get_oneshot_layer_state() == ONESHOT_TOGGLED) {
|
||||||
reset_oneshot_layer();
|
reset_oneshot_layer();
|
||||||
layer_off(action.layer_tap.val);
|
layer_off(action.layer_tap.val);
|
||||||
@ -633,10 +632,8 @@ void process_action(keyrecord_t *record, action_t action) {
|
|||||||
set_oneshot_layer(action.layer_tap.val, ONESHOT_START);
|
set_oneshot_layer(action.layer_tap.val, ONESHOT_START);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
add_mods(get_oneshot_locked_mods());
|
|
||||||
if (tap_count >= ONESHOT_TAP_TOGGLE) {
|
if (tap_count >= ONESHOT_TAP_TOGGLE) {
|
||||||
reset_oneshot_layer();
|
reset_oneshot_layer();
|
||||||
clear_oneshot_locked_mods();
|
|
||||||
set_oneshot_layer(action.layer_tap.val, ONESHOT_TOGGLED);
|
set_oneshot_layer(action.layer_tap.val, ONESHOT_TOGGLED);
|
||||||
} else {
|
} else {
|
||||||
clear_oneshot_layer_state(ONESHOT_PRESSED);
|
clear_oneshot_layer_state(ONESHOT_PRESSED);
|
||||||
|
Loading…
Reference in New Issue
Block a user