From 7b7701ae90469b920cd78e2ab7aca0c470140b7a Mon Sep 17 00:00:00 2001 From: Okke Formsma Date: Fri, 22 Jan 2021 17:00:19 +0100 Subject: feature(modifiers): add explicit modifiers this makes LS(LEFT_CONTROL) work as if shift and control were both pressed explicitly. Previously, the left shift would have been released as soon as another key was pressed. The implicit behavior is useful in case of LS(NUMBER_1) when rolling over to other keys. Also see #361. --- .../kp-hyper-dn-a-dn-a-up-hyper-up/events.patterns | 4 ++++ .../keycode_events.snapshot | 28 ++++++++++++++++++++++ .../native_posix.keymap | 28 ++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/events.patterns create mode 100644 app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/keycode_events.snapshot create mode 100644 app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/native_posix.keymap (limited to 'app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up') diff --git a/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/events.patterns b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/events.patterns new file mode 100644 index 0000000..cbf21af --- /dev/null +++ b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/events.patterns @@ -0,0 +1,4 @@ +s/.*hid_listener_keycode_//p +s/.*hid_register_mod/reg/p +s/.*hid_unregister_mod/unreg/p +s/.*zmk_hid_.*Modifiers set to /mods: Modifiers set to /p \ No newline at end of file diff --git a/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/keycode_events.snapshot new file mode 100644 index 0000000..e146b9c --- /dev/null +++ b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/keycode_events.snapshot @@ -0,0 +1,28 @@ +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x0e +reg: Modifier 0 count 1 +reg: Modifiers set to 0x01 +reg: Modifier 1 count 1 +reg: Modifiers set to 0x03 +reg: Modifier 2 count 1 +reg: Modifiers set to 0x07 +reg: Modifier 3 count 1 +reg: Modifiers set to 0x0f +mods: Modifiers set to 0x0f +pressed: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +mods: Modifiers set to 0x0f +released: usage_page 0x07 keycode 0x04 implicit_mods 0x00 explicit_mods 0x00 +mods: Modifiers set to 0x0f +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x0e +unreg: Modifier 0 count: 0 +unreg: Modifier 0 released +unreg: Modifiers set to 0x0e +unreg: Modifier 1 count: 0 +unreg: Modifier 1 released +unreg: Modifiers set to 0x0c +unreg: Modifier 2 count: 0 +unreg: Modifier 2 released +unreg: Modifiers set to 0x08 +unreg: Modifier 3 count: 0 +unreg: Modifier 3 released +unreg: Modifiers set to 0x00 +mods: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/native_posix.keymap b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/native_posix.keymap new file mode 100644 index 0000000..b814242 --- /dev/null +++ b/app/tests/modifiers/explicit/kp-hyper-dn-a-dn-a-up-hyper-up/native_posix.keymap @@ -0,0 +1,28 @@ +#include +#include +#include + + +&kscan { + events = < + ZMK_MOCK_PRESS(0,0,10) + ZMK_MOCK_PRESS(1,0,10) + ZMK_MOCK_RELEASE(1,0,10) + ZMK_MOCK_RELEASE(0,0,10) + + >; +}; + +/ { + keymap { + compatible = "zmk,keymap"; + label ="Default keymap"; + + default_layer { + bindings = < + &kp LS(LA(LG(LEFT_CONTROL))) &kp LEFT_CONTROL + &kp A &none + >; + }; + }; +}; -- cgit v1.2.3