[HID] Fix any poll on XInput.
This commit is contained in:
parent
c8da7fbfe4
commit
d7d5d92e59
|
@ -149,12 +149,16 @@ X_RESULT XInputInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
|
|||
// https://stackoverflow.com/questions/23669238/xinputgetkeystroke-returning-error-success-while-controller-is-unplugged
|
||||
//
|
||||
// So we first check if the device is connected via XInputGetCapabilities, so
|
||||
// we are not passing back an uninitialized X_INPUT_KEYSTROKE structure:
|
||||
XINPUT_CAPABILITIES caps;
|
||||
auto xigc = (decltype(&XInputGetCapabilities))XInputGetCapabilities_;
|
||||
result = xigc(user_index, 0, &caps);
|
||||
if (result) {
|
||||
return result;
|
||||
// we are not passing back an uninitialized X_INPUT_KEYSTROKE structure.
|
||||
// If any user (0xFF) is polled this bug does not occur but GetCapabilities
|
||||
// would fail so we need to skip it.
|
||||
if (user_index != 0xFF) {
|
||||
XINPUT_CAPABILITIES caps;
|
||||
auto xigc = (decltype(&XInputGetCapabilities))XInputGetCapabilities_;
|
||||
result = xigc(user_index, 0, &caps);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
XINPUT_KEYSTROKE native_keystroke;
|
||||
|
|
Loading…
Reference in New Issue