summaryrefslogtreecommitdiff
path: root/kvmd/plugins/hid/_mcu
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2025-01-10 23:04:12 +0200
committerMaxim Devaev <[email protected]>2025-01-10 23:04:12 +0200
commite7c06643b4a43c1d35bd2c3aaf4326547084b091 (patch)
tree7abb1ac834d3fa1685bf14af31a596397911b0c5 /kvmd/plugins/hid/_mcu
parent72c9ae3aa00b8817fab2b8243203ca6e1c25e146 (diff)
refactoring
Diffstat (limited to 'kvmd/plugins/hid/_mcu')
-rw-r--r--kvmd/plugins/hid/_mcu/proto.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/kvmd/plugins/hid/_mcu/proto.py b/kvmd/plugins/hid/_mcu/proto.py
index deaf5c15..315c1f89 100644
--- a/kvmd/plugins/hid/_mcu/proto.py
+++ b/kvmd/plugins/hid/_mcu/proto.py
@@ -26,6 +26,7 @@ import struct
from ....keyboard.mappings import KEYMAP
from ....mouse import MouseRange
+from ....mouse import MouseDelta
from .... import tools
from .... import bitbang
@@ -162,8 +163,8 @@ class MouseRelativeEvent(BaseEvent):
delta_y: int
def __post_init__(self) -> None:
- assert -127 <= self.delta_x <= 127
- assert -127 <= self.delta_y <= 127
+ assert MouseDelta.MIN <= self.delta_x <= MouseDelta.MAX
+ assert MouseDelta.MIN <= self.delta_y <= MouseDelta.MAX
def make_request(self) -> bytes:
return _make_request(struct.pack(">Bbbxx", 0x15, self.delta_x, self.delta_y))
@@ -175,8 +176,8 @@ class MouseWheelEvent(BaseEvent):
delta_y: int
def __post_init__(self) -> None:
- assert -127 <= self.delta_x <= 127
- assert -127 <= self.delta_y <= 127
+ assert MouseDelta.MIN <= self.delta_x <= MouseDelta.MAX
+ assert MouseDelta.MIN <= self.delta_y <= MouseDelta.MAX
def make_request(self) -> bytes:
# Горизонтальная прокрутка пока не поддерживается