mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
Add support for keyboard input that is not normalized to US English layout
This is used by the soft keyboards on Android and iOS
This commit is contained in:
@@ -338,15 +338,16 @@ namespace platf {
|
||||
}
|
||||
|
||||
void
|
||||
keyboard(input_t &input, uint16_t modcode, bool release) {
|
||||
keyboard(input_t &input, uint16_t modcode, bool release, uint8_t flags) {
|
||||
auto raw = (input_raw_t *) input.get();
|
||||
|
||||
INPUT i {};
|
||||
i.type = INPUT_KEYBOARD;
|
||||
auto &ki = i.ki;
|
||||
|
||||
// For some reason, MapVirtualKey(VK_LWIN, MAPVK_VK_TO_VSC) doesn't seem to work :/
|
||||
if (modcode != VK_LWIN && modcode != VK_RWIN && modcode != VK_PAUSE && raw->keyboard_layout != NULL) {
|
||||
// If the client did not normalize this VK code to a US English layout, we can't accurately convert it to a scancode.
|
||||
if (!(flags & SS_KBE_FLAG_NON_NORMALIZED) && modcode != VK_LWIN && modcode != VK_RWIN && modcode != VK_PAUSE && raw->keyboard_layout != NULL) {
|
||||
// For some reason, MapVirtualKey(VK_LWIN, MAPVK_VK_TO_VSC) doesn't seem to work :/
|
||||
ki.wScan = MapVirtualKeyEx(modcode, MAPVK_VK_TO_VSC, raw->keyboard_layout);
|
||||
}
|
||||
|
||||
@@ -355,7 +356,7 @@ namespace platf {
|
||||
ki.dwFlags = KEYEVENTF_SCANCODE;
|
||||
}
|
||||
else {
|
||||
// If there is no scancode mapping, send it as a regular VK event.
|
||||
// If there is no scancode mapping or it's non-normalized, send it as a regular VK event.
|
||||
ki.wVk = modcode;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user