Linux: Fix joystick disconnection detection
Joystick disconnection was not dectected by the event processing functions and required calling a joystick function. Fixes #932.
This commit is contained in:
parent
466347a335
commit
c5694b3013
@ -146,6 +146,7 @@ information on what to include when reporting a bug.
|
|||||||
- [Win32] Bugfix: Bitness test in `FindVulkan.cmake` was VS specific (#928)
|
- [Win32] Bugfix: Bitness test in `FindVulkan.cmake` was VS specific (#928)
|
||||||
- [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading
|
- [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading
|
||||||
- [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X
|
- [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X
|
||||||
|
- [Linux] Bugfix: Event processing did not detect joystick disconnection (#932)
|
||||||
- [Cocoa] Added support for Vulkan window surface creation via
|
- [Cocoa] Added support for Vulkan window surface creation via
|
||||||
[MoltenVK](https://moltengl.com/moltenvk/) (#870)
|
[MoltenVK](https://moltengl.com/moltenvk/) (#870)
|
||||||
- [Cocoa] Bugfix: Disabling window aspect ratio would assert (#852)
|
- [Cocoa] Bugfix: Disabling window aspect ratio would assert (#852)
|
||||||
|
@ -146,7 +146,7 @@ GLFWbool _glfwInitJoysticksLinux(void)
|
|||||||
|
|
||||||
_glfw.linjs.watch = inotify_add_watch(_glfw.linjs.inotify,
|
_glfw.linjs.watch = inotify_add_watch(_glfw.linjs.inotify,
|
||||||
dirname,
|
dirname,
|
||||||
IN_CREATE | IN_ATTRIB);
|
IN_CREATE | IN_ATTRIB | IN_DELETE);
|
||||||
if (_glfw.linjs.watch == -1)
|
if (_glfw.linjs.watch == -1)
|
||||||
{
|
{
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||||
@ -240,7 +240,22 @@ void _glfwDetectJoystickConnectionLinux(void)
|
|||||||
{
|
{
|
||||||
char path[20];
|
char path[20];
|
||||||
snprintf(path, sizeof(path), "/dev/input/%s", e->name);
|
snprintf(path, sizeof(path), "/dev/input/%s", e->name);
|
||||||
|
|
||||||
|
if (e->mask & (IN_CREATE | IN_ATTRIB))
|
||||||
openJoystickDevice(path);
|
openJoystickDevice(path);
|
||||||
|
else if (e->mask & IN_DELETE)
|
||||||
|
{
|
||||||
|
int jid;
|
||||||
|
|
||||||
|
for (jid = 0; jid <= GLFW_JOYSTICK_LAST; jid++)
|
||||||
|
{
|
||||||
|
if (strcmp(_glfw.joysticks[jid].linjs.path, path) == 0)
|
||||||
|
{
|
||||||
|
closeJoystick(_glfw.joysticks + jid);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += sizeof(struct inotify_event) + e->len;
|
offset += sizeof(struct inotify_event) + e->len;
|
||||||
|
Loading…
Reference in New Issue
Block a user