From 33d6733d6485911f147862c7ae12205812f0b4f5 Mon Sep 17 00:00:00 2001 From: Felipe Otamendi Date: Tue, 13 Jan 2015 23:36:25 -0200 Subject: [PATCH] Add a setting to allow for joystick input to work while not in focus. --- es-core/src/InputManager.cpp | 4 ++++ es-core/src/Settings.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index 5795f762d..9437b7a4f 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -1,5 +1,6 @@ #include "InputManager.h" #include "InputConfig.h" +#include "Settings.h" #include "Window.h" #include "Log.h" #include "pugixml/pugixml.hpp" @@ -45,6 +46,9 @@ void InputManager::init() if(initialized()) deinit(); + if (Settings::getInstance()->getBool("BackgroundJoystickInput")){ + SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); + } SDL_InitSubSystem(SDL_INIT_JOYSTICK); SDL_JoystickEventState(SDL_ENABLE); diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index 60352d949..779ee7142 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -39,6 +39,7 @@ void Settings::setDefaults() mBoolMap.clear(); mIntMap.clear(); + mBoolMap["BackgroundJoystickInput"] = false; mBoolMap["ParseGamelistOnly"] = false; mBoolMap["DrawFramerate"] = false; mBoolMap["ShowExit"] = true;