From 0a0a2024fd374e5d75158cbae878098c04955f68 Mon Sep 17 00:00:00 2001 From: Albert Liu <45282415+ggrtk@users.noreply.github.com> Date: Tue, 30 Jun 2020 07:51:52 -0700 Subject: [PATCH] SDLControllerInterface: Prefer cbutton.which for button events Functionally the same as caxis.which due to SDL_Event union, but prefer using SDL_ControllerButtonEvent members for button events. --- src/frontend-common/sdl_controller_interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend-common/sdl_controller_interface.cpp b/src/frontend-common/sdl_controller_interface.cpp index a2c54ed52..fab613b22 100644 --- a/src/frontend-common/sdl_controller_interface.cpp +++ b/src/frontend-common/sdl_controller_interface.cpp @@ -319,7 +319,7 @@ bool SDLControllerInterface::HandleControllerButtonEvent(const SDL_Event* ev) Log_DebugPrintf("controller %d button %d %s", ev->cbutton.which, ev->cbutton.button, ev->cbutton.state == SDL_PRESSED ? "pressed" : "released"); - auto it = GetControllerDataForJoystickId(ev->caxis.which); + auto it = GetControllerDataForJoystickId(ev->cbutton.which); if (it == m_controllers.end()) return false;