diff options
author | Maxim Devaev <[email protected]> | 2022-09-23 17:36:41 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-09-23 17:37:08 +0300 |
commit | 9272049f455bff184f4f98d72435644809e87d32 (patch) | |
tree | cf91521248c2235ff0925711b12be5d6fc1f0d96 /kvmd | |
parent | 737550e768613124046979b4ac35cf497ab627b6 (diff) |
pikvm/pikvm#820: VNC generates fake shift events for some clients
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/vnc/server.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kvmd/apps/vnc/server.py b/kvmd/apps/vnc/server.py index 9e2dd79b..25a6016f 100644 --- a/kvmd/apps/vnc/server.py +++ b/kvmd/apps/vnc/server.py @@ -328,6 +328,8 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes async def _on_key_event(self, code: int, state: bool) -> None: is_modifier = self.__switch_modifiers(code, state) variants = self.__symmap.get(code) + fake_shift = False + if variants: if is_modifier: web_key = variants.get(0) @@ -335,8 +337,19 @@ class _Client(RfbClient): # pylint: disable=too-many-instance-attributes web_key = variants.get(self.__modifiers) if web_key is None: web_key = variants.get(0) + + if web_key is None and self.__modifiers == 0 and SymmapModifiers.SHIFT in variants: + # JUMP doesn't send shift events: + # - https://github.com/pikvm/pikvm/issues/820 + web_key = variants[SymmapModifiers.SHIFT] + fake_shift = True + if web_key and self.__kvmd_ws: + if fake_shift: + await self.__kvmd_ws.send_key_event(WebModifiers.SHIFT_LEFT, True) await self.__kvmd_ws.send_key_event(web_key, state) + if fake_shift: + await self.__kvmd_ws.send_key_event(WebModifiers.SHIFT_LEFT, False) async def _on_ext_key_event(self, code: int, state: bool) -> None: web_key = AT1_TO_WEB.get(code) |