From b087e5c1f98ff77bdd091b269afa6965b4a4a205 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 24 Feb 2014 22:34:53 +0100 Subject: [PATCH] Fix key repeat of analog stick working only on some screens --- src/inputmanager.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/inputmanager.cpp b/src/inputmanager.cpp index 65b96d2..89e975e 100644 --- a/src/inputmanager.cpp +++ b/src/inputmanager.cpp @@ -279,16 +279,18 @@ bool InputManager::getButton(Button *button, bool wait) { Uint32 keyRepeatCallback(Uint32 timeout __attribute__((unused)), void *d) { struct Joystick *joystick = (struct Joystick *) d; - Uint8 hatState = joystick->hatState; + Uint8 hatState; if (joystick->axisState[1][AXIS_STATE_NEGATIVE]) - hatState |= SDL_HAT_UP; + hatState = SDL_HAT_UP; else if (joystick->axisState[1][AXIS_STATE_POSITIVE]) - hatState |= SDL_HAT_DOWN; - if (joystick->axisState[0][AXIS_STATE_NEGATIVE]) - hatState |= SDL_HAT_LEFT; + hatState = SDL_HAT_DOWN; + else if (joystick->axisState[0][AXIS_STATE_NEGATIVE]) + hatState = SDL_HAT_LEFT; else if (joystick->axisState[0][AXIS_STATE_POSITIVE]) - hatState |= SDL_HAT_RIGHT; + hatState = SDL_HAT_RIGHT; + else + hatState = joystick->hatState; SDL_JoyHatEvent e = { .type = SDL_JOYHATMOTION,