diff --git a/app/dts/behaviors.dtsi b/app/dts/behaviors.dtsi index 6695af40f86..6ff4b69cf95 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,6 +25,4 @@ #include #include #include -#include #include -#include diff --git a/app/dts/behaviors/mouse_key_press.dtsi b/app/dts/behaviors/mouse_key_press.dtsi index 975c24aaafb..729166eab40 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 00000000000..f9a99fede0c --- /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 c43455c3953..47dc6cece92 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 27b6aafe1d8..e9d141f845c 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 a00455bc9aa..0acc434997f 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 8e3071d4317..8b955846963 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 99fa148876f..6b9fa770b11 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 b1ddbc1d8d0..6351799bd2e 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 94faacceb61..6b9fa770b11 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 4767e0ac55e..3392dd0de2e 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 5ca5300c1a7..6b9fa770b11 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 153270231fa..d4cf5031252 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 91c4f16b9c0..6b9fa770b11 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 9dfa5b2a81c..7e4d7af2a1d 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 dfbc4a76eab..678f71c9ac2 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 aacacebba90..89d50e2b839 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 4fd9a25202c..d20154d5507 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 1d914136e28..5b02246b05f 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