diff options
author | Devaev Maxim <[email protected]> | 2020-05-22 21:07:54 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-05-22 21:07:54 +0300 |
commit | 43afd9acb3a7f2c94a3515f580ec3afcee720dc2 (patch) | |
tree | e1e3031ea1f083f17751c4997f29708dfb7e5d98 /kvmd/plugins/hid/serial.py | |
parent | 0fa0680bd7c28e246c70b5a5102e38a592bd0f0d (diff) |
server-side paste-as-keys
Diffstat (limited to 'kvmd/plugins/hid/serial.py')
-rw-r--r-- | kvmd/plugins/hid/serial.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/kvmd/plugins/hid/serial.py b/kvmd/plugins/hid/serial.py index 1725483b..f2ece19d 100644 --- a/kvmd/plugins/hid/serial.py +++ b/kvmd/plugins/hid/serial.py @@ -252,22 +252,24 @@ 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)) + def send_key_event(self, key: str, state: bool) -> None: + self.__queue_event(_KeyEvent(key, state)) - async def send_mouse_button_event(self, button: str, state: bool) -> None: - await self.__queue_event(_MouseButtonEvent(button, state)) + def send_mouse_button_event(self, button: str, state: bool) -> None: + 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)) + def send_mouse_move_event(self, to_x: int, to_y: int) -> None: + 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)) + def send_mouse_wheel_event(self, delta_x: int, delta_y: int) -> None: + self.__queue_event(_MouseWheelEvent(delta_x, delta_y)) - async def clear_events(self) -> None: - await self.__queue_event(_ClearEvent()) + def clear_events(self) -> None: + while not self.__events_queue.empty(): + self.__events_queue.get_nowait() + self.__queue_event(_ClearEvent()) - async def __queue_event(self, event: _BaseEvent) -> None: + def __queue_event(self, event: _BaseEvent) -> None: if not self.__stop_event.is_set(): self.__events_queue.put_nowait(event) |