Skip to content

Commit

Permalink
bugfix(combos): hold-taps must observe released combo events
Browse files Browse the repository at this point in the history
  • Loading branch information
okke-formsma committed Dec 21, 2020
1 parent fdf25c7 commit 013f865
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/behaviors/behavior_combo.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static void release_pressed_keys() {
}
struct position_state_changed *captured_event = pressed_keys[i];
pressed_keys[i] = NULL;
ZMK_EVENT_RAISE_AT(captured_event, behavior_combo);
ZMK_EVENT_RAISE(captured_event);
}
}

Expand Down
2 changes: 2 additions & 0 deletions app/tests/combo/combos-and-holdtaps-2/events.patterns
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
s/.*hid_listener_keycode_//p
s/.*combo//p
2 changes: 2 additions & 0 deletions app/tests/combo/combos-and-holdtaps-2/keycode_events.snapshot
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pressed: usage_page 0x07 keycode 0xe0 mods 0x00
pressed: usage_page 0x07 keycode 0xe4 mods 0x00
48 changes: 48 additions & 0 deletions app/tests/combo/combos-and-holdtaps-2/native_posix.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <dt-bindings/zmk/keys.h>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/kscan-mock.h>

&mt {
flavor = "hold-preferred";
};

/* This test verifies that hold-tap keys can observe
* events which were released from combos.
*/
/ {
behaviors {
combo_one {
compatible = "zmk,behavior-combo";
label = "COMBO_ONE";
timeout-ms = <100>;
key-positions = <0 2>;
bindings = <&kp Y>;
};
combo_two {
compatible = "zmk,behavior-combo";
label = "COMBO_TWO";
timeout-ms = <100>;
key-positions = <1 3>;
bindings = <&kp Z>;
};
};

keymap {
compatible = "zmk,keymap";
label ="Default keymap";

default_layer {
bindings = <
&mt LEFT_CONTROL A &mt RIGHT_CONTROL B
&none &none
>;
};
};
};

&kscan {
events = <
ZMK_MOCK_PRESS(0,0,0)
ZMK_MOCK_PRESS(0,1,300)
>;
};

0 comments on commit 013f865

Please sign in to comment.