Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
virtualhid_keyboard.cpp
Go to the documentation of this file.
1
6
7#include <string>
8
9namespace platf::keyboard {
10 void update(input_raw_t *raw, std::uint16_t key_code, bool release, std::uint8_t flags) {
11 if (!raw || !raw->keyboard) {
12 return;
13 }
14
15 lvh::KeyboardEvent event;
16 event.key_code = key_code;
17 event.pressed = !release;
18 event.uses_normalized_key_code = (flags & SS_KBE_FLAG_NON_NORMALIZED) == 0;
19 virtualhid::log_failure("keyboard event", raw->keyboard->submit(event));
20 }
21
22 void unicode(input_raw_t *raw, const char *utf8, int size) {
23 if (!raw || !raw->keyboard || !utf8 || size <= 0) {
24 return;
25 }
26
27 lvh::KeyboardTextEvent event;
28 event.text.assign(utf8, static_cast<std::size_t>(size));
29 virtualhid::log_failure("keyboard text", raw->keyboard->type_text(event));
30 }
31} // namespace platf::keyboard
void release(input_raw_t *raw, int index)
Free a gamepad whose stream ended; a detached desktop keeps it.
Keyboard translation for the Linux libvirtualhid backend.