From a29ee0033a3723643e3723d88c28155c664ed921 Mon Sep 17 00:00:00 2001 From: krikun98 Date: Mon, 3 May 2021 09:54:35 +0300 Subject: [PATCH] Added new mouse movement macros --- app/include/dt-bindings/zmk/mouse.h | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/app/include/dt-bindings/zmk/mouse.h b/app/include/dt-bindings/zmk/mouse.h index 16766ac1..007fe128 100644 --- a/app/include/dt-bindings/zmk/mouse.h +++ b/app/include/dt-bindings/zmk/mouse.h @@ -28,6 +28,22 @@ #define MB8 (0x80) +#define MB9 (0x0100) + +#define MB10 (0x0200) + +#define MB11 (0x0400) + +#define MB12 (0x0800) + +#define MB13 (0x1000) + +#define MB14 (0x2000) + +#define MB15 (0x4000) + +#define MB16 (0x8000) + /* Mouse move behavior */ #define MOVE_UP (0x0000FFFF) @@ -38,6 +54,13 @@ #define MOVE_RIGHT (0x00010000) +/* -32767 to 32767, barely usable beyond about 50 (probably depends on screen resolution) */ +#define MOVE_VERT(vert) ((vert) < 0 ? -(vert) : (1 << 16) - (vert)) + +#define MOVE_HOR(hor) (((hor) > 0 ? (hor) : (1 << 16) + (hor)) << 16) + +#define MOVE(hor, vert) (MOVE_HOR(hor) + MOVE_VERT(vert)) + /* Mouse wheel behavior */ #define WHEEL_UP (0x0001) @@ -47,3 +70,10 @@ #define WHEEL_LEFT (0xFF00) #define WHEEL_RIGHT (0x0100) + +/* -127 to 127, barely usable beyond about 10 */ +#define WHEEL_VERT(vert) ((vert) < 0 ? (1 << 8) + (vert) : vert) + +#define WHEEL_HOR(hor) (((hor) < 0 ? (1 << 8) + (hor) : hor) << 8) + +#define WHEEL(hor, vert) (WHEEL_HOR(hor) + WHEEL_VERT(vert))