Merge pull request #13 from cgutman/key_fixes

Fix incorrect key codes
This commit is contained in:
loki-47-6F-64 2020-01-22 14:45:01 +01:00 committed by GitHub
commit 8c378eb27e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

View File

@ -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:

View File

@ -219,7 +219,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;
}
@ -227,6 +227,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;
}