diff options
author | Devaev Maxim <[email protected]> | 2020-06-06 13:19:30 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-06-06 13:19:30 +0300 |
commit | 04c3763e69a1e7d1705d56de0cd6b3e5e13f519d (patch) | |
tree | 09be3a85e221d07837bd1a474c8538b424251f66 /kvmd/plugins/hid/otg/keyboard.py | |
parent | 1d7d4100a57b5d654c1434c91e97187fe25698ef (diff) |
send_key_events()
Diffstat (limited to 'kvmd/plugins/hid/otg/keyboard.py')
-rw-r--r-- | kvmd/plugins/hid/otg/keyboard.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kvmd/plugins/hid/otg/keyboard.py b/kvmd/plugins/hid/otg/keyboard.py index 63c15889..e0243798 100644 --- a/kvmd/plugins/hid/otg/keyboard.py +++ b/kvmd/plugins/hid/otg/keyboard.py @@ -22,8 +22,10 @@ import dataclasses +from typing import Tuple from typing import List from typing import Set +from typing import Iterable from typing import Optional from typing import Any @@ -89,12 +91,13 @@ class KeyboardProcess(BaseDeviceProcess): self._clear_queue() self._queue_event(_ResetEvent()) - def send_key_event(self, key: str, state: bool) -> None: - otg_key = KEYMAP[key].otg - if otg_key.is_modifier: - self._queue_event(_ModifierEvent(otg_key, state)) - else: - self._queue_event(_KeyEvent(otg_key, state)) + def send_key_events(self, keys: Iterable[Tuple[str, bool]]) -> None: + for (key, state) in keys: + otg_key = KEYMAP[key].otg + if otg_key.is_modifier: + self._queue_event(_ModifierEvent(otg_key, state)) + else: + self._queue_event(_KeyEvent(otg_key, state)) # ===== |