Skip to content

Commit 39c4e5f

Browse files
authored
Switch to native mouse API (#59)
ZMK now natively supports mouse movement as well as scroll (zmkfirmware/zmk#2477) This involves: - changing the KConfig values - switching to new behaviours - including new headers - renaming `SCROLL_*` to `SCRL_*`
1 parent 3c059f2 commit 39c4e5f

File tree

4 files changed

+19
-33
lines changed

4 files changed

+19
-33
lines changed

config/adv360pro.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ CONFIG_ZMK_BACKLIGHT=n
99
CONFIG_ZMK_SLEEP=y
1010
CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=1800000
1111

12-
# Mouse config, requires PR #778
13-
CONFIG_ZMK_MOUSE=y
14-
CONFIG_ZMK_MOUSE_TICK_DURATION=8
12+
# Mouse config
13+
CONFIG_ZMK_POINTING=y
14+
CONFIG_ZMK_POINTING_SMOOTH_SCROLLING=y

miryoku/miryoku.dtsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#include "miryoku.h"
1212

13+
#include <dt-bindings/zmk/pointing.h>
14+
1315
/ {
1416
keymap {
1517
compatible = "zmk,keymap";

miryoku/miryoku_kludge_mousekeyspr.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
delay-ms = <U_MOUSE_MOVE_DELAY>;
88
};
99

10-
&mwh {
10+
&msc {
1111
acceleration-exponent = <U_MOUSE_SCROLL_EXPONENT>;
1212
time-to-max-speed-ms = <U_MOUSE_SCROLL_TIME>;
1313
delay-ms = <U_MOUSE_SCROLL_DELAY>;

miryoku/miryoku_kludge_mousekeyspr.h

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,26 @@
33

44
#pragma once
55

6-
#include <dt-bindings/zmk/mouse.h>
7-
8-
#define U_MOUSE_MOVE_MAX 1000
6+
// Mouse move
7+
#define ZMK_POINTING_DEFAULT_MOVE_VAL 700
98
#define U_MOUSE_MOVE_EXPONENT 1
10-
#define U_MOUSE_MOVE_TIME 1000
9+
#define U_MOUSE_MOVE_TIME 300
1110
#define U_MOUSE_MOVE_DELAY 0
12-
#define U_MOUSE_SCROLL_MAX 10
11+
12+
// Mouse scroll
13+
#define ZMK_POINTING_DEFAULT_SCRL_VAL 100
1314
#define U_MOUSE_SCROLL_EXPONENT 1
1415
#define U_MOUSE_SCROLL_TIME 0
1516
#define U_MOUSE_SCROLL_DELAY 0
1617

17-
#undef MOVE_UP
18-
#undef MOVE_DOWN
19-
#undef MOVE_LEFT
20-
#undef MOVE_RIGHT
21-
#undef SCROLL_UP
22-
#undef SCROLL_DOWN
23-
#undef SCROLL_LEFT
24-
#undef SCROLL_RIGHT
25-
#define MOVE_UP MOVE_VERT(-U_MOUSE_MOVE_MAX)
26-
#define MOVE_DOWN MOVE_VERT(U_MOUSE_MOVE_MAX)
27-
#define MOVE_LEFT MOVE_HOR(-U_MOUSE_MOVE_MAX)
28-
#define MOVE_RIGHT MOVE_HOR(U_MOUSE_MOVE_MAX)
29-
#define SCROLL_UP SCROLL_VERT(U_MOUSE_SCROLL_MAX)
30-
#define SCROLL_DOWN SCROLL_VERT(-U_MOUSE_SCROLL_MAX)
31-
#define SCROLL_LEFT SCROLL_HOR(-U_MOUSE_SCROLL_MAX)
32-
#define SCROLL_RIGHT SCROLL_HOR(U_MOUSE_SCROLL_MAX)
33-
34-
#define U_BTN1 &mkp MB1
35-
#define U_BTN2 &mkp MB2
36-
#define U_BTN3 &mkp MB3
18+
#define U_BTN1 &mkp LCLK
19+
#define U_BTN2 &mkp RCLK
20+
#define U_BTN3 &mkp MCLK
3721
#define U_MS_D &mmv MOVE_DOWN
3822
#define U_MS_L &mmv MOVE_LEFT
3923
#define U_MS_R &mmv MOVE_RIGHT
4024
#define U_MS_U &mmv MOVE_UP
41-
#define U_WH_D &mwh SCROLL_DOWN
42-
#define U_WH_L &mwh SCROLL_LEFT
43-
#define U_WH_R &mwh SCROLL_RIGHT
44-
#define U_WH_U &mwh SCROLL_UP
25+
#define U_WH_D &msc SCRL_DOWN
26+
#define U_WH_L &msc SCRL_LEFT
27+
#define U_WH_R &msc SCRL_RIGHT
28+
#define U_WH_U &msc SCRL_UP

0 commit comments

Comments
 (0)