summaryrefslogtreecommitdiff
path: root/kvmd/plugins/hid
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-11-03 06:17:52 +0300
committerDevaev Maxim <[email protected]>2020-11-03 06:17:52 +0300
commitc31115051cb17a650e6d42e3e5cbfe05de809760 (patch)
tree457dd0414d0840a64d5de9c491413c6b1de783a3 /kvmd/plugins/hid
parent544f4b3fecb84e2ae21eb71ec0c37c8bec38261c (diff)
configurable wheel for otg
Diffstat (limited to 'kvmd/plugins/hid')
-rw-r--r--kvmd/plugins/hid/otg/__init__.py1
-rw-r--r--kvmd/plugins/hid/otg/mouse.py6
2 files changed, 6 insertions, 1 deletions
diff --git a/kvmd/plugins/hid/otg/__init__.py b/kvmd/plugins/hid/otg/__init__.py
index 9521e764..aa3d79b2 100644
--- a/kvmd/plugins/hid/otg/__init__.py
+++ b/kvmd/plugins/hid/otg/__init__.py
@@ -76,6 +76,7 @@ class Plugin(BaseHid):
"write_retries_delay": Option(0.1, type=valid_float_f01),
"reopen_delay": Option(0.5, type=valid_float_f01),
"absolute": Option(True, type=valid_bool),
+ "horizontal_wheel": Option(True, type=valid_bool),
},
"noop": Option(False, type=valid_bool),
}
diff --git a/kvmd/plugins/hid/otg/mouse.py b/kvmd/plugins/hid/otg/mouse.py
index e8e5c6e7..079a7dc3 100644
--- a/kvmd/plugins/hid/otg/mouse.py
+++ b/kvmd/plugins/hid/otg/mouse.py
@@ -69,6 +69,7 @@ class _WheelEvent(BaseEvent):
class MouseProcess(BaseDeviceProcess):
def __init__(self, **kwargs: Any) -> None:
self.__absolute: bool = kwargs.pop("absolute")
+ self.__horizontal_wheel: bool = kwargs.pop("horizontal_wheel")
super().__init__(
name="mouse",
@@ -212,4 +213,7 @@ class MouseProcess(BaseDeviceProcess):
def __make_report(self, buttons: int, move_x: int, move_y: int, wheel_x: int, wheel_y: int) -> bytes:
# XXX: Wheel Y before X: it's ok.
# See /kvmd/apps/otg/hid/mouse.py for details
- return struct.pack(("<BHHbb" if self.__absolute else "<Bbbbb"), buttons, move_x, move_y, wheel_y, wheel_x)
+ if self.__horizontal_wheel:
+ return struct.pack(("<BHHbb" if self.__absolute else "<Bbbbb"), buttons, move_x, move_y, wheel_y, wheel_x)
+ else:
+ return struct.pack(("<BHHb" if self.__absolute else "<Bbbb"), buttons, move_x, move_y, wheel_y)