using evdev instead of string constants

This commit is contained in:
Maxim Devaev
2025-05-01 03:03:25 +03:00
parent 1624b0cbf8
commit ebbd55ee17
29 changed files with 692 additions and 539 deletions

View File

@@ -20,6 +20,8 @@
# ========================================================================== #
from evdev import ecodes
from . import tools
@@ -46,3 +48,13 @@ class MouseDelta:
@classmethod
def normalize(cls, value: int) -> int:
return min(max(cls.MIN, value), cls.MAX)
# =====
MOUSE_TO_EVDEV = {
"left": ecodes.BTN_LEFT,
"right": ecodes.BTN_RIGHT,
"middle": ecodes.BTN_MIDDLE,
"up": ecodes.BTN_BACK,
"down": ecodes.BTN_FORWARD,
}