mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix non-SDL build with compilers that fail to respect short-circuiting
This commit is contained in:
parent
5a932631be
commit
13fbf3e6e3
|
@ -207,10 +207,12 @@ void InputController::setPreferredGamepad(uint32_t type, const QString& device)
|
||||||
}
|
}
|
||||||
|
|
||||||
GBARumble* InputController::rumble() {
|
GBARumble* InputController::rumble() {
|
||||||
#if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0)
|
#ifdef BUILD_SDL
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
if (m_playerAttached) {
|
if (m_playerAttached) {
|
||||||
return &m_sdlPlayer.rumble.d;
|
return &m_sdlPlayer.rumble.d;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -497,19 +499,29 @@ bool InputController::hasPendingEvent(GBAKey key) const {
|
||||||
return m_pendingEvents.contains(key);
|
return m_pendingEvents.contains(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0)
|
|
||||||
void InputController::suspendScreensaver() {
|
void InputController::suspendScreensaver() {
|
||||||
|
#ifdef BUILD_SDL
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
GBASDLSuspendScreensaver(&s_sdlEvents);
|
GBASDLSuspendScreensaver(&s_sdlEvents);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputController::resumeScreensaver() {
|
void InputController::resumeScreensaver() {
|
||||||
|
#ifdef BUILD_SDL
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
GBASDLResumeScreensaver(&s_sdlEvents);
|
GBASDLResumeScreensaver(&s_sdlEvents);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputController::setScreensaverSuspendable(bool suspendable) {
|
void InputController::setScreensaverSuspendable(bool suspendable) {
|
||||||
|
#ifdef BUILD_SDL
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
GBASDLSetScreensaverSuspendable(&s_sdlEvents, suspendable);
|
GBASDLSetScreensaverSuspendable(&s_sdlEvents, suspendable);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void InputController::stealFocus(QWidget* focus) {
|
void InputController::stealFocus(QWidget* focus) {
|
||||||
m_focusParent = focus;
|
m_focusParent = focus;
|
||||||
|
|
|
@ -87,12 +87,10 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
void testGamepad(int type);
|
void testGamepad(int type);
|
||||||
|
|
||||||
#if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0)
|
|
||||||
// TODO: Move these to somewhere that makes sense
|
// TODO: Move these to somewhere that makes sense
|
||||||
void suspendScreensaver();
|
void suspendScreensaver();
|
||||||
void resumeScreensaver();
|
void resumeScreensaver();
|
||||||
void setScreensaverSuspendable(bool);
|
void setScreensaverSuspendable(bool);
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void postPendingEvent(GBAKey);
|
void postPendingEvent(GBAKey);
|
||||||
|
|
|
@ -210,9 +210,7 @@ void Window::loadConfig() {
|
||||||
enterFullScreen();
|
enterFullScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0)
|
|
||||||
m_inputController.setScreensaverSuspendable(opts->suspendScreensaver);
|
m_inputController.setScreensaverSuspendable(opts->suspendScreensaver);
|
||||||
#endif
|
|
||||||
|
|
||||||
m_mruFiles = m_config->getMRU();
|
m_mruFiles = m_config->getMRU();
|
||||||
updateMRU();
|
updateMRU();
|
||||||
|
|
Loading…
Reference in New Issue