From 9e11ba9902b171d45fa49b8eecfde2824650d609 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 21 Jan 2020 20:36:10 -0800 Subject: [PATCH 1/2] Fix XK_KP_Decimal and XK_KP_Separator being swapped on Linux --- sunshine/platform/linux_evdev.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sunshine/platform/linux_evdev.cpp b/sunshine/platform/linux_evdev.cpp index 061e4875..e51c24bf 100644 --- a/sunshine/platform/linux_evdev.cpp +++ b/sunshine/platform/linux_evdev.cpp @@ -153,11 +153,11 @@ uint16_t keysym(uint16_t modcode) { case 0x6B: return XK_KP_Add; case 0x6C: - return XK_KP_Decimal; + return XK_KP_Separator; case 0x6D: return XK_KP_Subtract; case 0x6E: - return XK_KP_Separator; + return XK_KP_Decimal; case 0x6F: return XK_KP_Divide; case 0x90: From 96eff20c028351d609ee4cd84abd38b23010f73b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 21 Jan 2020 20:36:49 -0800 Subject: [PATCH 2/2] Fix extended keys on Windows --- sunshine/platform/windows.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/sunshine/platform/windows.cpp b/sunshine/platform/windows.cpp index 0c45cdce..6e01cd47 100755 --- a/sunshine/platform/windows.cpp +++ b/sunshine/platform/windows.cpp @@ -169,7 +169,7 @@ void keyboard(input_t &input, uint16_t modcode, bool release) { 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) { + if(modcode != VK_LWIN && modcode != VK_RWIN && modcode != VK_PAUSE) { ki.wScan = MapVirtualKey(modcode, MAPVK_VK_TO_VSC); ki.dwFlags = KEYEVENTF_SCANCODE; } @@ -177,6 +177,27 @@ void keyboard(input_t &input, uint16_t modcode, bool release) { ki.wVk = modcode; } + // https://docs.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#keystroke-message-flags + switch(modcode) { + case VK_RMENU: + case VK_RCONTROL: + case VK_INSERT: + case VK_DELETE: + case VK_HOME: + case VK_END: + case VK_PRIOR: + case VK_NEXT: + case VK_UP: + case VK_DOWN: + case VK_LEFT: + case VK_RIGHT: + case VK_DIVIDE: + ki.dwFlags |= KEYEVENTF_EXTENDEDKEY; + break; + default: + break; + } + if(release) { ki.dwFlags |= KEYEVENTF_KEYUP; }