summaryrefslogtreecommitdiff
path: root/kvmd/plugins/hid/otg/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/plugins/hid/otg/__init__.py')
-rw-r--r--kvmd/plugins/hid/otg/__init__.py50
1 files changed, 24 insertions, 26 deletions
diff --git a/kvmd/plugins/hid/otg/__init__.py b/kvmd/plugins/hid/otg/__init__.py
index 7686ebdd..c95fb7fb 100644
--- a/kvmd/plugins/hid/otg/__init__.py
+++ b/kvmd/plugins/hid/otg/__init__.py
@@ -22,7 +22,6 @@
import copy
-from typing import Iterable
from typing import AsyncGenerator
from typing import Any
@@ -48,15 +47,20 @@ from .mouse import MouseProcess
class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
def __init__(
self,
+ ignore_keys: list[str],
+ mouse_x_range: dict[str, Any],
+ mouse_y_range: dict[str, Any],
+ jiggler: dict[str, Any],
+
keyboard: dict[str, Any],
mouse: dict[str, Any],
mouse_alt: dict[str, Any],
- jiggler: dict[str, Any],
noop: bool,
+
udc: str, # XXX: Not from options, see /kvmd/apps/kvmd/__init__.py for details
) -> None:
- super().__init__(**jiggler)
+ super().__init__(ignore_keys=ignore_keys, **mouse_x_range, **mouse_y_range, **jiggler)
self.__udc = udc
@@ -115,7 +119,7 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
"horizontal_wheel": Option(True, type=valid_bool),
},
"noop": Option(False, type=valid_bool),
- **cls._get_jiggler_options(),
+ **cls._get_base_options(),
}
def sysprep(self) -> None:
@@ -183,26 +187,6 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
# =====
- def send_key_events(self, keys: Iterable[tuple[str, bool]]) -> None:
- self.__keyboard_proc.send_key_events(keys)
- self._bump_activity()
-
- def send_mouse_button_event(self, button: str, state: bool) -> None:
- self.__mouse_current.send_button_event(button, state)
- self._bump_activity()
-
- def send_mouse_move_event(self, to_x: int, to_y: int) -> None:
- self.__mouse_current.send_move_event(to_x, to_y)
- self._bump_activity()
-
- def send_mouse_relative_event(self, delta_x: int, delta_y: int) -> None:
- self.__mouse_current.send_relative_event(delta_x, delta_y)
- self._bump_activity()
-
- def send_mouse_wheel_event(self, delta_x: int, delta_y: int) -> None:
- self.__mouse_current.send_wheel_event(delta_x, delta_y)
- self._bump_activity()
-
def set_params(
self,
keyboard_output: (str | None)=None,
@@ -221,12 +205,26 @@ class Plugin(BaseHid): # pylint: disable=too-many-instance-attributes
self._set_jiggler_active(jiggler)
self.__notifier.notify()
- def clear_events(self) -> None:
+ def _send_key_event(self, key: str, state: bool) -> None:
+ self.__keyboard_proc.send_key_event(key, state)
+
+ def _send_mouse_button_event(self, button: str, state: bool) -> None:
+ self.__mouse_current.send_button_event(button, state)
+
+ def _send_mouse_move_event(self, to_x: int, to_y: int) -> None:
+ self.__mouse_current.send_move_event(to_x, to_y)
+
+ def _send_mouse_relative_event(self, delta_x: int, delta_y: int) -> None:
+ self.__mouse_current.send_relative_event(delta_x, delta_y)
+
+ def _send_mouse_wheel_event(self, delta_x: int, delta_y: int) -> None:
+ self.__mouse_current.send_wheel_event(delta_x, delta_y)
+
+ def _clear_events(self) -> None:
self.__keyboard_proc.send_clear_event()
self.__mouse_proc.send_clear_event()
if self.__mouse_alt_proc:
self.__mouse_alt_proc.send_clear_event()
- self._bump_activity()
# =====