[HID] Fix any poll on XInput.
This commit is contained in:
parent
c8da7fbfe4
commit
d7d5d92e59
|
@ -149,13 +149,17 @@ X_RESULT XInputInputDriver::GetKeystroke(uint32_t user_index, uint32_t flags,
|
||||||
// https://stackoverflow.com/questions/23669238/xinputgetkeystroke-returning-error-success-while-controller-is-unplugged
|
// 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
|
// So we first check if the device is connected via XInputGetCapabilities, so
|
||||||
// we are not passing back an uninitialized X_INPUT_KEYSTROKE structure:
|
// 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;
|
XINPUT_CAPABILITIES caps;
|
||||||
auto xigc = (decltype(&XInputGetCapabilities))XInputGetCapabilities_;
|
auto xigc = (decltype(&XInputGetCapabilities))XInputGetCapabilities_;
|
||||||
result = xigc(user_index, 0, &caps);
|
result = xigc(user_index, 0, &caps);
|
||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XINPUT_KEYSTROKE native_keystroke;
|
XINPUT_KEYSTROKE native_keystroke;
|
||||||
auto xigk = (decltype(&XInputGetKeystroke))XInputGetKeystroke_;
|
auto xigk = (decltype(&XInputGetKeystroke))XInputGetKeystroke_;
|
||||||
|
|
Loading…
Reference in New Issue