diff --git a/app/src/behaviors/behavior_sticky_key.c b/app/src/behaviors/behavior_sticky_key.c index 23753014..5c4c7cbe 100644 --- a/app/src/behaviors/behavior_sticky_key.c +++ b/app/src/behaviors/behavior_sticky_key.c @@ -213,6 +213,8 @@ static int sticky_key_keycode_state_changed_listener(const struct zmk_event_head sticky_key->modified_key_usage_page == ev->usage_page && sticky_key->modified_key_keycode == ev->keycode) { release_sticky_key_behavior(sticky_key, ev->timestamp); + stop_timer(sticky_key); + clear_sticky_key(sticky_key); } } } diff --git a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot index 758ed616..dba30cc2 100644 --- a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot +++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/keycode_events.snapshot @@ -2,3 +2,7 @@ pressed: usage_page 0x07 keycode 0x08 mods 0x00 pressed: usage_page 0x07 keycode 0x04 mods 0x00 released: usage_page 0x07 keycode 0x08 mods 0x00 released: usage_page 0x07 keycode 0x04 mods 0x00 +pressed: usage_page 0x07 keycode 0x08 mods 0x00 +pressed: usage_page 0x07 keycode 0x04 mods 0x00 +released: usage_page 0x07 keycode 0x08 mods 0x00 +released: usage_page 0x07 keycode 0x04 mods 0x00 diff --git a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap index 588f6a1a..c96eb9f9 100644 --- a/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap +++ b/app/tests/sticky-keys/2-os-dn-up-kcdn-kcup/native_posix.keymap @@ -9,5 +9,11 @@ ZMK_MOCK_RELEASE(0,0,10) ZMK_MOCK_PRESS(1,0,10) ZMK_MOCK_RELEASE(1,0,10) + + /* repeat test to check if cleanup is done correctly */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) >; }; \ No newline at end of file diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns b/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns new file mode 100644 index 00000000..833100f6 --- /dev/null +++ b/app/tests/sticky-keys/8-lsk-osk-combination/events.patterns @@ -0,0 +1 @@ +s/.*hid_listener_keycode_//p \ No newline at end of file diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot b/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot new file mode 100644 index 00000000..51660c34 --- /dev/null +++ b/app/tests/sticky-keys/8-lsk-osk-combination/keycode_events.snapshot @@ -0,0 +1,8 @@ +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0x1c mods 0x00 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0x1c mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0x1c mods 0x00 +released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0x1c mods 0x00 diff --git a/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap b/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap new file mode 100644 index 00000000..45cef501 --- /dev/null +++ b/app/tests/sticky-keys/8-lsk-osk-combination/native_posix.keymap @@ -0,0 +1,47 @@ +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &sk E &sl 1 + &kp A &kp B>; + }; + + lower_layer { + bindings = < + &sk LEFT_CONTROL &kp X + &kp Y &kp Z>; + }; + }; +}; + +&kscan { + events = < + /* tap sl lower_layer */ + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + /* tap sk LEFT_CONTROL */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* tap Y */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + + /* repeat */ + /* tap sl */ + ZMK_MOCK_PRESS(0,1,10) + ZMK_MOCK_RELEASE(0,1,10) + /* tap sk */ + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_RELEASE(0,0,10) + /* tap Y */ + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + >; +}; \ No newline at end of file