From 29fc52cfa17dcc7327c1a081918721cd7cfcf40b Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 22 Feb 2015 20:36:30 -0600 Subject: [Android] Stop eating button events we don't handle. We were eating /all/ button events except the back button. This would cause issues where Android wouldn't receive button press events for things like volume rockers. So you couldn't change the audio ingame, even if that button isn't bound to an input. Now we return to Android if we've handled that button press, so it works fine. --- Source/Core/DolphinWX/Android/ButtonManager.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Source/Core/DolphinWX/Android/ButtonManager.cpp') diff --git a/Source/Core/DolphinWX/Android/ButtonManager.cpp b/Source/Core/DolphinWX/Android/ButtonManager.cpp index 7b1004415f..53e64513ba 100644 --- a/Source/Core/DolphinWX/Android/ButtonManager.cpp +++ b/Source/Core/DolphinWX/Android/ButtonManager.cpp @@ -156,16 +156,14 @@ namespace ButtonManager } return value; } - void GamepadEvent(std::string dev, int button, int action) + bool GamepadEvent(std::string dev, int button, int action) { auto it = m_controllers.find(dev); if (it != m_controllers.end()) - { - it->second->PressEvent(button, action); - return; - } + return it->second->PressEvent(button, action); + m_controllers[dev] = new InputDevice(dev); - m_controllers[dev]->PressEvent(button, action); + return m_controllers[dev]->PressEvent(button, action); } void GamepadAxisEvent(std::string dev, int axis, float value) { @@ -186,8 +184,9 @@ namespace ButtonManager } // InputDevice - void InputDevice::PressEvent(int button, int action) + bool InputDevice::PressEvent(int button, int action) { + bool handled = false; for (const auto& binding : _inputbinds) { if (binding.second->_bind == button) @@ -196,8 +195,10 @@ namespace ButtonManager _buttons[binding.second->_buttontype] = action == BUTTON_PRESSED ? true : false; else _axises[binding.second->_buttontype] = action == BUTTON_PRESSED ? 1.0f : 0.0f; + handled = true; } } + return handled; } void InputDevice::AxisEvent(int axis, float value) { -- cgit v1.2.3