[HID] Improved WinKey GetKeystroke code
Seems the double-keypress issue was because of XINPUT_KEYSTROKE_REPEAT: Xenia would add that to keyup events, but seems REPEAT is only meant for keydown (well SR1 treats it as a keydown event at least)
This commit is contained in:
parent
2351d56512
commit
cfcf0e70c5
|
@ -383,33 +383,24 @@ X_RESULT WinKeyInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cvars::keyboard_passthru) {
|
if (virtual_key != 0) {
|
||||||
if (virtual_key != 0) {
|
if (evt.transition == true) {
|
||||||
if (evt.transition == true) {
|
keystroke_flags |= 0x0001; // XINPUT_KEYSTROKE_KEYDOWN
|
||||||
keystroke_flags |= 0x0001; // XINPUT_KEYSTROKE_KEYDOWN
|
|
||||||
} else if (evt.transition == false) {
|
|
||||||
keystroke_flags |= 0x0002; // XINPUT_KEYSTROKE_KEYUP
|
|
||||||
}
|
|
||||||
|
|
||||||
if (evt.prev_state == evt.transition) {
|
if (evt.prev_state == evt.transition) {
|
||||||
keystroke_flags |= 0x0004; // XINPUT_KEYSTROKE_REPEAT
|
keystroke_flags |= 0x0004; // XINPUT_KEYSTROKE_REPEAT
|
||||||
}
|
}
|
||||||
|
} else if (evt.transition == false) {
|
||||||
result = X_ERROR_SUCCESS;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Handle keydown & keyup:
|
|
||||||
if (evt.transition == false) {
|
|
||||||
keystroke_flags |= 0x0002; // XINPUT_KEYSTROKE_KEYUP
|
keystroke_flags |= 0x0002; // XINPUT_KEYSTROKE_KEYUP
|
||||||
} else if (evt.transition == true) {
|
|
||||||
keystroke_flags |= 0x0001; // XINPUT_KEYSTROKE_KEYDOWN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keystroke_flags != 0) {
|
if (cvars::keyboard_passthru) {
|
||||||
WCHAR buf;
|
WCHAR buf;
|
||||||
if (ToUnicode(virtual_key, 0, key_map_, &buf, 1, 0) == 1) {
|
if (ToUnicode(virtual_key, 0, key_map_, &buf, 1, 0) == 1) {
|
||||||
unicode = buf;
|
unicode = buf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keystroke_flags) {
|
||||||
result = X_ERROR_SUCCESS;
|
result = X_ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue