Skip to content

Commit

Permalink
fix: Testing fixes for listener refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
petejohanson committed Apr 7, 2024
1 parent ca28e83 commit f446ab4
Show file tree
Hide file tree
Showing 19 changed files with 80 additions and 59 deletions.
8 changes: 6 additions & 2 deletions app/dts/behaviors.dtsi
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include <behaviors/key_press.dtsi>
#include <behaviors/key_toggle.dtsi>
#include <behaviors/transparent.dtsi>
Expand All @@ -19,6 +25,4 @@
#include <behaviors/key_repeat.dtsi>
#include <behaviors/backlight.dtsi>
#include <behaviors/macros.dtsi>
#include <behaviors/mouse_key_press.dtsi>
#include <behaviors/soft_off.dtsi>
#include <behaviors/macros.dtsi>
5 changes: 5 additions & 0 deletions app/dts/behaviors/mouse_key_press.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
#binding-cells = <1>;
};
};

mkp_input_listener {
compatible = "zmk,input-listener";
device = <&mkp>;
};
};
9 changes: 9 additions & 0 deletions app/dts/behaviors/mouse_keys.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "mouse_key_press.dtsi"
#include "mouse_move.dtsi"
#include "mouse_scroll.dtsi"
6 changes: 6 additions & 0 deletions app/dts/behaviors/mouse_move.dtsi
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
Expand Down
6 changes: 6 additions & 0 deletions app/dts/behaviors/mouse_scroll.dtsi
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright (c) 2024 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
Expand Down
2 changes: 1 addition & 1 deletion app/src/mouse/input_listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static void input_handler(const struct input_listener_config *config,

if (data->button_clear != 0) {
for (int i = 0; i < ZMK_HID_MOUSE_NUM_BUTTONS; i++) {
if ((data->button_set & BIT(i)) != 0) {
if ((data->button_clear & BIT(i)) != 0) {
zmk_hid_mouse_button_release(i);
}
}
Expand Down
1 change: 1 addition & 0 deletions app/tests/mouse-keys/mkp/native_posix_64.keymap
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <behaviors.dtsi>
#include <behaviors/mouse_keys.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
#include <dt-bindings/zmk/mouse.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
movement_update: Mouse movement updated to -1/0
movement_set: Mouse movement set to -1/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -3/0
movement_update: Mouse movement updated to -3/-3
movement_set: Mouse movement set to -2/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -3/0
movement_update: Mouse movement updated to -3/-3
movement_set: Mouse movement set to -2/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -5/0
movement_update: Mouse movement updated to -5/-3
movement_set: Mouse movement set to -3/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -5/0
movement_update: Mouse movement updated to -5/-5
movement_set: Mouse movement set to -3/-3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/-5
movement_set: Mouse movement set to 0/-3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <behaviors.dtsi>
#include <behaviors/mouse_move.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
#include <dt-bindings/zmk/mouse.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
movement_update: Mouse movement updated to 1/0
movement_set: Mouse movement set to -1/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 2/0
movement_update: Mouse movement updated to 2/2
movement_set: Mouse movement set to -2/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 2/0
movement_update: Mouse movement updated to 2/2
movement_set: Mouse movement set to -2/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 3/0
movement_update: Mouse movement updated to 3/2
movement_set: Mouse movement set to -3/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 3/0
movement_update: Mouse movement updated to 3/3
movement_set: Mouse movement set to -3/-3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/3
movement_set: Mouse movement set to 0/-3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <behaviors.dtsi>
#include <behaviors/mouse_move.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
#include <dt-bindings/zmk/mouse.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
movement_update: Mouse movement updated to 0/-1
movement_set: Mouse movement set to -1/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/-2
movement_update: Mouse movement updated to -2/-2
movement_set: Mouse movement set to -2/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/-2
movement_update: Mouse movement updated to -2/-2
movement_set: Mouse movement set to -2/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/-3
movement_update: Mouse movement updated to -2/-3
movement_set: Mouse movement set to -3/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/-3
movement_update: Mouse movement updated to -3/-3
movement_set: Mouse movement set to -3/-3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -3/0
movement_set: Mouse movement set to 0/-3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <behaviors.dtsi>
#include <behaviors/mouse_move.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
#include <dt-bindings/zmk/mouse.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
movement_update: Mouse movement updated to -1/0
movement_set: Mouse movement set to -1/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -2/0
movement_update: Mouse movement updated to -2/-2
movement_set: Mouse movement set to -2/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -2/0
movement_update: Mouse movement updated to -2/-2
movement_set: Mouse movement set to -2/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -3/0
movement_update: Mouse movement updated to -3/-2
movement_set: Mouse movement set to -3/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -3/0
movement_update: Mouse movement updated to -3/-3
movement_set: Mouse movement set to -3/-3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/-3
movement_set: Mouse movement set to 0/-3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <behaviors.dtsi>
#include <behaviors/mouse_move.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
#include <dt-bindings/zmk/mouse.h>
Expand Down
16 changes: 8 additions & 8 deletions app/tests/mouse-keys/mouse-move/move_x/keycode_events.snapshot
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
movement_update: Mouse movement updated to -1/0
movement_set: Mouse movement set to -1/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -2/0
movement_set: Mouse movement set to -2/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -2/0
movement_set: Mouse movement set to -2/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to -3/0
movement_set: Mouse movement set to -3/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 1/0
movement_set: Mouse movement set to 1/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 2/0
movement_set: Mouse movement set to 2/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 2/0
movement_set: Mouse movement set to 2/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 3/0
movement_set: Mouse movement set to 3/0
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <behaviors.dtsi>
#include <behaviors/mouse_move.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
#include <dt-bindings/zmk/mouse.h>
Expand Down
16 changes: 8 additions & 8 deletions app/tests/mouse-keys/mouse-move/move_y/keycode_events.snapshot
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
movement_update: Mouse movement updated to 0/-1
movement_set: Mouse movement set to 0/-1
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/-2
movement_set: Mouse movement set to 0/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/-2
movement_set: Mouse movement set to 0/-2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/-3
movement_set: Mouse movement set to 0/-3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/1
movement_set: Mouse movement set to 0/1
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/2
movement_set: Mouse movement set to 0/2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/2
movement_set: Mouse movement set to 0/2
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
movement_update: Mouse movement updated to 0/3
movement_set: Mouse movement set to 0/3
scroll_set: Mouse scroll set to 0/0
movement_set: Mouse movement set to 0/0
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <behaviors.dtsi>
#include <behaviors/mouse_move.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/kscan_mock.h>
#include <dt-bindings/zmk/mouse.h>
Expand Down

0 comments on commit f446ab4

Please sign in to comment.