Qt: Fix toggled actions on gamepads (fixes #1650)

This commit is contained in:
Vicki Pfau 2020-01-28 18:13:39 -08:00
parent e217a1fefb
commit cd2bb61b0e
2 changed files with 16 additions and 3 deletions

View File

@ -18,6 +18,7 @@ Other fixes:
- Qt: Fix color selection in asset view (fixes mgba.io/i/1648)
- Qt: Fix missing OSD messages
- Qt: Fix crash unloading shaders
- Qt: Fix toggled actions on gamepads (fixes mgba.io/i/1650)
0.8.0: (2020-01-21)
Features:

View File

@ -159,7 +159,11 @@ bool ShortcutController::eventFilter(QObject*, QEvent* event) {
}
Action* action = item.value()->action();
if (action) {
action->trigger();
if (m_actions->isHeld(action->name())) {
action->trigger(true);
} else {
action->trigger(!action->isActive());
}
}
event->accept();
return true;
@ -170,7 +174,7 @@ bool ShortcutController::eventFilter(QObject*, QEvent* event) {
return false;
}
Action* action = item.value()->action();
if (action) {
if (action && m_actions->isHeld(action->name())) {
action->trigger(false);
}
event->accept();
@ -184,7 +188,15 @@ bool ShortcutController::eventFilter(QObject*, QEvent* event) {
}
Action* action = item.value()->action();
if (action) {
action->trigger(gae->isNew());
if (gae->isNew()) {
if (m_actions->isHeld(action->name())) {
action->trigger(true);
} else {
action->trigger(!action->isActive());
}
} else if (m_actions->isHeld(action->name())) {
action->trigger(false);
}
}
event->accept();
return true;