diff --git a/app/dts/behaviors.dtsi b/app/dts/behaviors.dtsi index 34adbe335dbf..f3adc8f3a530 100644 --- a/app/dts/behaviors.dtsi +++ b/app/dts/behaviors.dtsi @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + #include #include #include @@ -19,5 +25,3 @@ #include #include #include -#include -#include diff --git a/app/dts/behaviors/mouse_key_press.dtsi b/app/dts/behaviors/mouse_key_press.dtsi index 975c24aaafbd..729166eab409 100644 --- a/app/dts/behaviors/mouse_key_press.dtsi +++ b/app/dts/behaviors/mouse_key_press.dtsi @@ -5,4 +5,9 @@ #binding-cells = <1>; }; }; + + mkp_input_listener { + compatible = "zmk,input-listener"; + device = <&mkp>; + }; }; diff --git a/app/dts/behaviors/mouse_keys.dtsi b/app/dts/behaviors/mouse_keys.dtsi new file mode 100644 index 000000000000..f9a99fede0cf --- /dev/null +++ b/app/dts/behaviors/mouse_keys.dtsi @@ -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" \ No newline at end of file diff --git a/app/dts/behaviors/mouse_move.dtsi b/app/dts/behaviors/mouse_move.dtsi index c43455c3953a..47dc6cece921 100644 --- a/app/dts/behaviors/mouse_move.dtsi +++ b/app/dts/behaviors/mouse_move.dtsi @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + #include / { diff --git a/app/dts/behaviors/mouse_scroll.dtsi b/app/dts/behaviors/mouse_scroll.dtsi index 27b6aafe1d85..e9d141f845c3 100644 --- a/app/dts/behaviors/mouse_scroll.dtsi +++ b/app/dts/behaviors/mouse_scroll.dtsi @@ -1,3 +1,9 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + #include / { diff --git a/app/src/mouse/input_listener.c b/app/src/mouse/input_listener.c index a00455bc9aa2..0acc434997f3 100644 --- a/app/src/mouse/input_listener.c +++ b/app/src/mouse/input_listener.c @@ -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); } } diff --git a/app/tests/mouse-keys/mkp/native_posix_64.keymap b/app/tests/mouse-keys/mkp/native_posix_64.keymap index 8e3071d4317d..8b9558469634 100644 --- a/app/tests/mouse-keys/mkp/native_posix_64.keymap +++ b/app/tests/mouse-keys/mkp/native_posix_64.keymap @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/keycode_events.snapshot b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/keycode_events.snapshot index 99fa148876f8..6b9fa770b115 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/keycode_events.snapshot +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/keycode_events.snapshot @@ -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 diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.keymap b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.keymap index b1ddbc1d8d0d..6351799bd2ed 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.keymap +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_scaling/native_posix_64.keymap @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/keycode_events.snapshot b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/keycode_events.snapshot index 94faacceb619..6b9fa770b115 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/keycode_events.snapshot +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/keycode_events.snapshot @@ -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 diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.keymap b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.keymap index 4767e0ac55e5..3392dd0de2e7 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.keymap +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_invert/native_posix_64.keymap @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/keycode_events.snapshot b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/keycode_events.snapshot index 5ca5300c1a7e..6b9fa770b115 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/keycode_events.snapshot +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/keycode_events.snapshot @@ -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 diff --git a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.keymap b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.keymap index 153270231fad..d4cf50312528 100644 --- a/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.keymap +++ b/app/tests/mouse-keys/mouse-move/input-configs/move_diagonal_xy_swap/native_posix_64.keymap @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/app/tests/mouse-keys/mouse-move/move_diagonal/keycode_events.snapshot b/app/tests/mouse-keys/mouse-move/move_diagonal/keycode_events.snapshot index 91c4f16b9c03..6b9fa770b115 100644 --- a/app/tests/mouse-keys/mouse-move/move_diagonal/keycode_events.snapshot +++ b/app/tests/mouse-keys/mouse-move/move_diagonal/keycode_events.snapshot @@ -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 diff --git a/app/tests/mouse-keys/mouse-move/move_diagonal/native_posix_64.keymap b/app/tests/mouse-keys/mouse-move/move_diagonal/native_posix_64.keymap index 9dfa5b2a81c1..7e4d7af2a1d6 100644 --- a/app/tests/mouse-keys/mouse-move/move_diagonal/native_posix_64.keymap +++ b/app/tests/mouse-keys/mouse-move/move_diagonal/native_posix_64.keymap @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/app/tests/mouse-keys/mouse-move/move_x/keycode_events.snapshot b/app/tests/mouse-keys/mouse-move/move_x/keycode_events.snapshot index dfbc4a76eab4..678f71c9ac2c 100644 --- a/app/tests/mouse-keys/mouse-move/move_x/keycode_events.snapshot +++ b/app/tests/mouse-keys/mouse-move/move_x/keycode_events.snapshot @@ -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 diff --git a/app/tests/mouse-keys/mouse-move/move_x/native_posix_64.keymap b/app/tests/mouse-keys/mouse-move/move_x/native_posix_64.keymap index aacacebba907..89d50e2b8392 100644 --- a/app/tests/mouse-keys/mouse-move/move_x/native_posix_64.keymap +++ b/app/tests/mouse-keys/mouse-move/move_x/native_posix_64.keymap @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/app/tests/mouse-keys/mouse-move/move_y/keycode_events.snapshot b/app/tests/mouse-keys/mouse-move/move_y/keycode_events.snapshot index 4fd9a25202ca..d20154d55073 100644 --- a/app/tests/mouse-keys/mouse-move/move_y/keycode_events.snapshot +++ b/app/tests/mouse-keys/mouse-move/move_y/keycode_events.snapshot @@ -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 diff --git a/app/tests/mouse-keys/mouse-move/move_y/native_posix_64.keymap b/app/tests/mouse-keys/mouse-move/move_y/native_posix_64.keymap index 1d914136e280..5b02246b05f5 100644 --- a/app/tests/mouse-keys/mouse-move/move_y/native_posix_64.keymap +++ b/app/tests/mouse-keys/mouse-move/move_y/native_posix_64.keymap @@ -1,4 +1,5 @@ #include +#include #include #include #include