all repos — mgba @ 569e6ef7db2ac225af64ecd43e916147a6ae3141

mGBA Game Boy Advance Emulator

Qt: Clear active buttons when focus is lost
Jeffrey Pfau jeffrey@endrift.com
Fri, 02 Jan 2015 02:03:12 -0800
commit

569e6ef7db2ac225af64ecd43e916147a6ae3141

parent

338486338215add02c7aba0e2ddcdb2094417c78

M CHANGESCHANGES

@@ -47,6 +47,7 @@ - GBA Audio: Change internal audio sample buffer from 32-bit to 16-bit samples

- Qt: Set default log level to FATAL, ERROR and WARN - Qt: Clarify some phrasing in the menus - GBA Memory: Implement 16- and 32-bit loads from SRAM + - Qt: Clear active buttons when focus is lost 0.1.0: (2014-12-13) - Initial release
M src/platform/qt/GameController.cppsrc/platform/qt/GameController.cpp

@@ -310,6 +310,11 @@ m_activeKeys &= ~mappedKey;

updateKeys(); } +void GameController::clearKeys() { + m_activeKeys = 0; + updateKeys(); +} + void GameController::setAudioBufferSamples(int samples) { threadInterrupt(); redoSamples(samples);
M src/platform/qt/GameController.hsrc/platform/qt/GameController.h

@@ -82,6 +82,7 @@ void reset();

void frameAdvance(); void keyPressed(int key); void keyReleased(int key); + void clearKeys(); void setAudioBufferSamples(int samples); void setFPSTarget(float fps); void loadState(int slot);
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -306,6 +306,11 @@ emit shutdown();

QMainWindow::closeEvent(event); } +void Window::focusOutEvent(QFocusEvent*) { + m_controller->setTurbo(false, false); + m_controller->clearKeys(); +} + void Window::toggleFullScreen() { if (isFullScreen()) { showNormal();
M src/platform/qt/Window.hsrc/platform/qt/Window.h

@@ -86,6 +86,7 @@ virtual void keyPressEvent(QKeyEvent* event) override;

virtual void keyReleaseEvent(QKeyEvent* event) override; virtual void resizeEvent(QResizeEvent*) override; virtual void closeEvent(QCloseEvent*) override; + virtual void focusOutEvent(QFocusEvent*) override; private slots: void gameStarted(GBAThread*);