mirror of
https://github.com/LizardByte/Sunshine.git
synced 2024-11-18 11:10:04 +00:00
Use Scan codes instead of Virtual Keys to improve keyboard support in games
This commit is contained in:
parent
7ce24287b3
commit
2ad2222c83
@ -76,13 +76,19 @@ void keyboard(input_t &input, uint16_t modcode, bool release) {
|
|||||||
i.type = INPUT_KEYBOARD;
|
i.type = INPUT_KEYBOARD;
|
||||||
auto &ki = i.ki;
|
auto &ki = i.ki;
|
||||||
|
|
||||||
// ki.dwFlags = KEYEVENTF_SCANCODE;
|
// For some reason, MapVirtualKey(VK_LWIN, MAPVK_VK_TO_VSC) doesn't seem to work :/
|
||||||
|
if(modcode != VK_LWIN && modcode != VK_RWIN) {
|
||||||
|
ki.wScan = MapVirtualKey(modcode, MAPVK_VK_TO_VSC);
|
||||||
|
ki.dwFlags = KEYEVENTF_SCANCODE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ki.wVk = modcode;
|
||||||
|
}
|
||||||
|
|
||||||
if(release) {
|
if(release) {
|
||||||
ki.dwFlags = KEYEVENTF_KEYUP;
|
ki.dwFlags = KEYEVENTF_KEYUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
ki.wVk = modcode;
|
|
||||||
|
|
||||||
auto send = SendInput(1, &i, sizeof(INPUT));
|
auto send = SendInput(1, &i, sizeof(INPUT));
|
||||||
if(send != 1) {
|
if(send != 1) {
|
||||||
BOOST_LOG(warning) << "Couldn't send moue movement input"sv;
|
BOOST_LOG(warning) << "Couldn't send moue movement input"sv;
|
||||||
|
Loading…
Reference in New Issue
Block a user