Skip to content

Commit

Permalink
Added new mouse movement macros
Browse files Browse the repository at this point in the history
  • Loading branch information
krikun98 committed Jan 28, 2022
1 parent 0893c76 commit fddadb9
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app/include/dt-bindings/zmk/mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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))

0 comments on commit fddadb9

Please sign in to comment.