From deba2926cee8dcb5ebc0698f0d9363e9cf1a1184 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Thu, 29 Aug 2013 01:39:21 -0300 Subject: [PATCH] Prefer the Joystick name rather than the GameController name for Joystick:getName --- src/modules/joystick/sdl/Joystick.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/joystick/sdl/Joystick.cpp b/src/modules/joystick/sdl/Joystick.cpp index f63cf5e1e..f18243e9d 100644 --- a/src/modules/joystick/sdl/Joystick.cpp +++ b/src/modules/joystick/sdl/Joystick.cpp @@ -70,11 +70,13 @@ bool Joystick::open(int deviceindex) // See if SDL thinks this is a Game Controller. openGamepad(deviceindex); - // Prefer the GameController name. - if (controller) - name = SDL_GameControllerName(controller); - else - name = SDL_JoystickName(joyhandle); + // Prefer the Joystick name for consistency. + const char *joyname = SDL_JoystickName(joyhandle); + if (!joyname && controller) + joyname = SDL_GameControllerName(controller); + + if (joyname) + name = joyname; } return isConnected();