diff options
author | Maxim Devaev <[email protected]> | 2024-12-30 18:55:59 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-12-30 18:55:59 +0200 |
commit | fed3bf1efdea7528919eb9f318c5ada2dcf35410 (patch) | |
tree | f1bd27d882b85cf845b92b489b1c494c4d1dd715 /kvmd/plugins | |
parent | d52bb34bb9f5bc669f6b915ba585461356128e39 (diff) |
pikvm/pikvm#1334: Bad link mode for keyboard events
Diffstat (limited to 'kvmd/plugins')
-rw-r--r-- | kvmd/plugins/hid/__init__.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kvmd/plugins/hid/__init__.py b/kvmd/plugins/hid/__init__.py index 447b4d07..5063f53e 100644 --- a/kvmd/plugins/hid/__init__.py +++ b/kvmd/plugins/hid/__init__.py @@ -37,6 +37,7 @@ from ...validators.basic import valid_string_list from ...validators.hid import valid_hid_key from ...validators.hid import valid_hid_mouse_move +from ...keyboard.mappings import WebModifiers from ...mouse import MouseRange from .. import BasePlugin @@ -148,10 +149,14 @@ class BaseHid(BasePlugin): # pylint: disable=too-many-instance-attributes if no_ignore_keys or key not in self.__ignore_keys: if slow: await asyncio.sleep(0.02) - self.send_key_event(key, state) + self.send_key_event(key, state, False) - def send_key_event(self, key: str, state: bool) -> None: + def send_key_event(self, key: str, state: bool, finish: bool) -> None: self._send_key_event(key, state) + if state and finish and (key not in WebModifiers.ALL and key != "PrintScreen"): + # Считаем что PrintScreen это модификатор для Alt+SysRq+... + # По-хорошему надо учитывать факт нажатия на Alt, но можно и забить. + self._send_key_event(key, False) self.__bump_activity() def _send_key_event(self, key: str, state: bool) -> None: |