diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2015-02-22 20:36:30 -0600 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2015-02-24 05:38:16 -0600 |
| commit | 29fc52cfa17dcc7327c1a081918721cd7cfcf40b (patch) | |
| tree | ee3c9ccfd8a89bea2fbf8d32bbca7df5909d7a4b /Source/Core/DolphinWX/Android/ButtonManager.cpp | |
| parent | 4e5d115bf0fcff7e78b93868adb38a6726b1ee3e (diff) | |
[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.
Diffstat (limited to 'Source/Core/DolphinWX/Android/ButtonManager.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/Android/ButtonManager.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
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) { |
