diff options
author | Okke Formsma <okke@formsma.nl> | 2021-01-22 17:00:19 +0100 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2021-01-24 23:30:41 -0500 |
commit | 7b7701ae90469b920cd78e2ab7aca0c470140b7a (patch) | |
tree | b4fade597239b5f0df24197faea3413e305a636f /app/tests/modifiers/explicit | |
parent | 0c30b49063c79be2416453f4544795922efad74f (diff) |
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.
Diffstat (limited to 'app/tests/modifiers/explicit')
7 files changed, 74 insertions, 14 deletions
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 <dt-bindings/zmk/keys.h> +#include <behaviors.dtsi> +#include <dt-bindings/zmk/kscan-mock.h> + + +&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 + >; + }; + }; +}; diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot index 6218e65..25b7944 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-dn-lctl-up-lctl-up/keycode_events.snapshot @@ -1,16 +1,16 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 2 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 1 unreg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot index 4232428..545af6e 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lctl-up/keycode_events.snapshot @@ -1,8 +1,8 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot index 60d829a..b744542 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lctl-up-lsft-up/keycode_events.snapshot @@ -1,17 +1,17 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 1 count 1 reg: Modifiers set to 0x03 mods: Modifiers set to 0x03 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x02 mods: Modifiers set to 0x02 -released: usage_page 0x07 keycode 0xe1 mods 0x00 +released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 1 count: 0 unreg: Modifier 1 released unreg: Modifiers set to 0x00 diff --git a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot index b4755e5..74916a8 100644 --- a/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot +++ b/app/tests/modifiers/explicit/kp-lctl-dn-lsft-dn-lsft-up-lctl-up/keycode_events.snapshot @@ -1,17 +1,17 @@ -pressed: usage_page 0x07 keycode 0xe0 mods 0x00 +pressed: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 0 count 1 reg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -pressed: usage_page 0x07 keycode 0xe1 mods 0x00 +pressed: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 reg: Modifier 1 count 1 reg: Modifiers set to 0x03 mods: Modifiers set to 0x03 -released: usage_page 0x07 keycode 0xe1 mods 0x00 +released: usage_page 0x07 keycode 0xe1 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 1 count: 0 unreg: Modifier 1 released unreg: Modifiers set to 0x01 mods: Modifiers set to 0x01 -released: usage_page 0x07 keycode 0xe0 mods 0x00 +released: usage_page 0x07 keycode 0xe0 implicit_mods 0x00 explicit_mods 0x00 unreg: Modifier 0 count: 0 unreg: Modifier 0 released unreg: Modifiers set to 0x00 |