Linux: Fix joystick EV_KEY handling indexing below 0 on keyboard input

This commit is contained in:
MediocreDev 2023-12-29 02:16:46 -05:00
parent b4c3ef9d0f
commit 71995aeee9
3 changed files with 4 additions and 1 deletions

View File

@ -278,6 +278,7 @@ video tutorials.
- Jonas Ådahl - Jonas Ådahl
- Lasse Öörni - Lasse Öörni
- Leonard König - Leonard König
- Liam Malone
- All the unmentioned and anonymous contributors in the GLFW community, for bug - All the unmentioned and anonymous contributors in the GLFW community, for bug
reports, patches, feedback, testing and encouragement reports, patches, feedback, testing and encouragement

View File

@ -121,6 +121,8 @@ information on what to include when reporting a bug.
## Changelog ## Changelog
- Bugfix: Linux joystick handling would crash with some keyboards, indexing the
associated KeyMap with a value less than 0
- Added `GLFW_PLATFORM` init hint for runtime platform selection (#1958) - Added `GLFW_PLATFORM` init hint for runtime platform selection (#1958)
- Added `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, - Added `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`,
`GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` and `GLFW_PLATFORM_NULL` symbols to `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` and `GLFW_PLATFORM_NULL` symbols to

View File

@ -51,7 +51,7 @@
// //
static void handleKeyEvent(_GLFWjoystick* js, int code, int value) static void handleKeyEvent(_GLFWjoystick* js, int code, int value)
{ {
_glfwInputJoystickButton(js, if (code - BTN_MISC >= 0) _glfwInputJoystickButton(js,
js->linjs.keyMap[code - BTN_MISC], js->linjs.keyMap[code - BTN_MISC],
value ? GLFW_PRESS : GLFW_RELEASE); value ? GLFW_PRESS : GLFW_RELEASE);
} }