diff options
author | Maxim Devaev <[email protected]> | 2025-01-10 23:04:12 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2025-01-10 23:04:12 +0200 |
commit | e7c06643b4a43c1d35bd2c3aaf4326547084b091 (patch) | |
tree | 7abb1ac834d3fa1685bf14af31a596397911b0c5 /kvmd/validators | |
parent | 72c9ae3aa00b8817fab2b8243203ca6e1c25e146 (diff) |
refactoring
Diffstat (limited to 'kvmd/validators')
-rw-r--r-- | kvmd/validators/hid.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kvmd/validators/hid.py b/kvmd/validators/hid.py index 376a7f62..0f74a6eb 100644 --- a/kvmd/validators/hid.py +++ b/kvmd/validators/hid.py @@ -25,6 +25,7 @@ from typing import Any from ..keyboard.mappings import KEYMAP from ..mouse import MouseRange +from ..mouse import MouseDelta from . import check_string_in_list @@ -46,7 +47,7 @@ def valid_hid_key(arg: Any) -> str: def valid_hid_mouse_move(arg: Any) -> int: arg = valid_number(arg, name="Mouse move") - return min(max(MouseRange.MIN, arg), MouseRange.MAX) + return MouseRange.normalize(arg) def valid_hid_mouse_button(arg: Any) -> str: @@ -55,4 +56,4 @@ def valid_hid_mouse_button(arg: Any) -> str: def valid_hid_mouse_delta(arg: Any) -> int: arg = valid_number(arg, name="Mouse delta") - return min(max(-127, arg), 127) + return MouseDelta.normalize(arg) |