This commit is contained in:
Yang sheng 2024-05-27 12:51:49 +08:00 committed by GitHub
commit e0c68348f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -386,6 +386,7 @@ void _glfwTerminateJoysticksLinux(void)
GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
{
// Read all queued events (non-blocking)
GLFWbool event_valid = GLFW_FALSE;
for (;;)
{
struct input_event e;
@ -396,6 +397,8 @@ GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
// Reset the joystick slot if the device was disconnected
if (errno == ENODEV)
closeJoystick(js);
else if ((errno == EAGAIN) && (mode != _GLFW_POLL_PRESENCE))
return event_valid;
break;
}
@ -407,6 +410,7 @@ GLFWbool _glfwPollJoystickLinux(_GLFWjoystick* js, int mode)
else if (e.code == SYN_REPORT)
{
_glfw.linjs.dropped = GLFW_FALSE;
event_valid = GLFW_TRUE;
pollAbsState(js);
}
}