mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-04 17:32:47 +00:00
[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.
This commit is contained in:
parent
4e5d115bf0
commit
29fc52cfa1
5 changed files with 18 additions and 15 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue