summaryrefslogtreecommitdiff
path: root/kvmd/plugins
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2019-10-01 21:23:45 +0300
committerDevaev Maxim <[email protected]>2019-10-01 21:23:45 +0300
commit4d668e9c1aa5162965437f0186924f6e56432bbd (patch)
tree6f869ab05d0123c3cec2e621b7b67c15c1b370e8 /kvmd/plugins
parentf71c06a9a9b349bf3804e698afc6686178f4968f (diff)
refactoring
Diffstat (limited to 'kvmd/plugins')
-rw-r--r--kvmd/plugins/hid/__init__.py4
-rw-r--r--kvmd/plugins/hid/serial.py32
2 files changed, 18 insertions, 18 deletions
diff --git a/kvmd/plugins/hid/__init__.py b/kvmd/plugins/hid/__init__.py
index 5bc5ca52..4e0ce5ea 100644
--- a/kvmd/plugins/hid/__init__.py
+++ b/kvmd/plugins/hid/__init__.py
@@ -51,10 +51,10 @@ class BaseHid(BasePlugin):
async def send_key_event(self, key: str, state: bool) -> None:
raise NotImplementedError
- async def send_mouse_move_event(self, to_x: int, to_y: int) -> None:
+ async def send_mouse_button_event(self, button: str, state: bool) -> None:
raise NotImplementedError
- async def send_mouse_button_event(self, button: str, state: bool) -> None:
+ async def send_mouse_move_event(self, to_x: int, to_y: int) -> None:
raise NotImplementedError
async def send_mouse_wheel_event(self, delta_x: int, delta_y: int) -> None:
diff --git a/kvmd/plugins/hid/serial.py b/kvmd/plugins/hid/serial.py
index 4a4346dc..3f9fe23b 100644
--- a/kvmd/plugins/hid/serial.py
+++ b/kvmd/plugins/hid/serial.py
@@ -82,19 +82,6 @@ class _KeyEvent(_BaseEvent):
@dataclasses.dataclass(frozen=True)
-class _MouseMoveEvent(_BaseEvent):
- to_x: int
- to_y: int
-
- def __post_init__(self) -> None:
- assert -32768 <= self.to_x <= 32767
- assert -32768 <= self.to_y <= 32767
-
- def make_command(self) -> bytes:
- return struct.pack(">Bhh", 0x12, self.to_x, self.to_y)
-
-
[email protected](frozen=True)
class _MouseButtonEvent(_BaseEvent):
name: str
state: bool
@@ -114,6 +101,19 @@ class _MouseButtonEvent(_BaseEvent):
@dataclasses.dataclass(frozen=True)
+class _MouseMoveEvent(_BaseEvent):
+ to_x: int
+ to_y: int
+
+ def __post_init__(self) -> None:
+ assert -32768 <= self.to_x <= 32767
+ assert -32768 <= self.to_y <= 32767
+
+ def make_command(self) -> bytes:
+ return struct.pack(">Bhh", 0x12, self.to_x, self.to_y)
+
+
[email protected](frozen=True)
class _MouseWheelEvent(_BaseEvent):
delta_x: int
delta_y: int
@@ -248,12 +248,12 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst
async def send_key_event(self, key: str, state: bool) -> None:
await self.__queue_event(_KeyEvent(key, state))
- async def send_mouse_move_event(self, to_x: int, to_y: int) -> None:
- await self.__queue_event(_MouseMoveEvent(to_x, to_y))
-
async def send_mouse_button_event(self, button: str, state: bool) -> None:
await self.__queue_event(_MouseButtonEvent(button, state))
+ async def send_mouse_move_event(self, to_x: int, to_y: int) -> None:
+ await self.__queue_event(_MouseMoveEvent(to_x, to_y))
+
async def send_mouse_wheel_event(self, delta_x: int, delta_y: int) -> None:
await self.__queue_event(_MouseWheelEvent(delta_x, delta_y))