1
0
Fork 0

Deactivate one shot keys if already used in next keydown

This commit is contained in:
Cat /dev/Nulo 2022-02-22 22:40:23 -03:00
parent e97eef5f86
commit c6e976889f
2 changed files with 14 additions and 1 deletions

View file

@ -37,6 +37,18 @@ void update_oneshot(
*state = os_up_unqueued; *state = os_up_unqueued;
unregister_code(mod); unregister_code(mod);
} }
if (!is_oneshot_ignored_key(keycode)) {
switch (*state) {
case os_up_used:
unregister_code(mod);
break;
case os_up_queued:
*state = os_up_used;
break;
default:
break;
}
}
} else { } else {
if (!is_oneshot_ignored_key(keycode)) { if (!is_oneshot_ignored_key(keycode)) {
// On non-ignored keyup, consider the oneshot used. // On non-ignored keyup, consider the oneshot used.
@ -44,7 +56,7 @@ void update_oneshot(
case os_down_unused: case os_down_unused:
*state = os_down_used; *state = os_down_used;
break; break;
case os_up_queued: case os_up_used:
*state = os_up_unqueued; *state = os_up_unqueued;
unregister_code(mod); unregister_code(mod);
break; break;

View file

@ -6,6 +6,7 @@
typedef enum { typedef enum {
os_up_unqueued, os_up_unqueued,
os_up_queued, os_up_queued,
os_up_used,
os_down_unused, os_down_unused,
os_down_used, os_down_used,
} oneshot_state; } oneshot_state;