mirror of https://github.com/mgba-emu/mgba.git
Qt: Focusing a button when mapping a gamepad now works
This commit is contained in:
parent
61fc28e03e
commit
58d8cdde82
|
@ -219,10 +219,24 @@ void GBAKeyEditor::bindKey(const KeyEditor* keyEditor, GBAKey key) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GBAKeyEditor::findFocus() {
|
||||||
|
if (m_currentKey != m_keyOrder.end() && (*m_currentKey)->hasFocus()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto key = m_keyOrder.begin(); key != m_keyOrder.end(); ++key) {
|
||||||
|
if ((*key)->hasFocus()) {
|
||||||
|
m_currentKey = key;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef BUILD_SDL
|
#ifdef BUILD_SDL
|
||||||
void GBAKeyEditor::testGamepad() {
|
void GBAKeyEditor::testGamepad() {
|
||||||
m_gamepadTimer->setInterval(50);
|
m_gamepadTimer->setInterval(50);
|
||||||
if (m_currentKey == m_keyOrder.end() || !*m_currentKey) {
|
if (!findFocus()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
KeyEditor* focused = *m_currentKey;
|
KeyEditor* focused = *m_currentKey;
|
||||||
|
|
|
@ -53,6 +53,8 @@ private:
|
||||||
void lookupBinding(const GBAInputMap*, KeyEditor*, GBAKey);
|
void lookupBinding(const GBAInputMap*, KeyEditor*, GBAKey);
|
||||||
void bindKey(const KeyEditor*, GBAKey);
|
void bindKey(const KeyEditor*, GBAKey);
|
||||||
|
|
||||||
|
bool findFocus();
|
||||||
|
|
||||||
#ifdef BUILD_SDL
|
#ifdef BUILD_SDL
|
||||||
void lookupAxes(const GBAInputMap*);
|
void lookupAxes(const GBAInputMap*);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue