summaryrefslogtreecommitdiff
path: root/kvmd/apps
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/apps
parentf71c06a9a9b349bf3804e698afc6686178f4968f (diff)
refactoring
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/kvmd/server.py20
-rw-r--r--kvmd/apps/otg/hid/keyboard.py4
-rw-r--r--kvmd/apps/otg/hid/mouse.py4
3 files changed, 14 insertions, 14 deletions
diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py
index 6b68be37..81f2c0b4 100644
--- a/kvmd/apps/kvmd/server.py
+++ b/kvmd/apps/kvmd/server.py
@@ -383,10 +383,10 @@ class Server: # pylint: disable=too-many-instance-attributes
await ws.send_str(json.dumps({"msg_type": "pong"}))
elif event_type == "key":
await self.__handle_ws_key_event(event)
- elif event_type == "mouse_move":
- await self.__handle_ws_mouse_move_event(event)
elif event_type == "mouse_button":
await self.__handle_ws_mouse_button_event(event)
+ elif event_type == "mouse_move":
+ await self.__handle_ws_mouse_move_event(event)
elif event_type == "mouse_wheel":
await self.__handle_ws_mouse_wheel_event(event)
else:
@@ -403,14 +403,6 @@ class Server: # pylint: disable=too-many-instance-attributes
return
await self.__hid.send_key_event(key, state)
- async def __handle_ws_mouse_move_event(self, event: Dict) -> None:
- try:
- to_x = valid_hid_mouse_move(event["to"]["x"])
- to_y = valid_hid_mouse_move(event["to"]["y"])
- except Exception:
- return
- await self.__hid.send_mouse_move_event(to_x, to_y)
-
async def __handle_ws_mouse_button_event(self, event: Dict) -> None:
try:
button = valid_hid_mouse_button(event["button"])
@@ -419,6 +411,14 @@ class Server: # pylint: disable=too-many-instance-attributes
return
await self.__hid.send_mouse_button_event(button, state)
+ async def __handle_ws_mouse_move_event(self, event: Dict) -> None:
+ try:
+ to_x = valid_hid_mouse_move(event["to"]["x"])
+ to_y = valid_hid_mouse_move(event["to"]["y"])
+ except Exception:
+ return
+ await self.__hid.send_mouse_move_event(to_x, to_y)
+
async def __handle_ws_mouse_wheel_event(self, event: Dict) -> None:
try:
delta_x = valid_hid_mouse_wheel(event["delta"]["x"])
diff --git a/kvmd/apps/otg/hid/keyboard.py b/kvmd/apps/otg/hid/keyboard.py
index 274406fd..29b62e07 100644
--- a/kvmd/apps/otg/hid/keyboard.py
+++ b/kvmd/apps/otg/hid/keyboard.py
@@ -25,8 +25,8 @@ from . import Hid
# =====
KEYBOARD_HID = Hid(
- protocol=1,
- subclass=1,
+ protocol=1, # Keyboard protocol
+ subclass=1, # Boot interface subclass
report_length=8,
diff --git a/kvmd/apps/otg/hid/mouse.py b/kvmd/apps/otg/hid/mouse.py
index bed1ffb2..57e75e43 100644
--- a/kvmd/apps/otg/hid/mouse.py
+++ b/kvmd/apps/otg/hid/mouse.py
@@ -25,8 +25,8 @@ from . import Hid
# =====
MOUSE_HID = Hid(
- protocol=0,
- subclass=0,
+ protocol=0, # None protocol
+ subclass=0, # No subclass
report_length=7,