Qt: Fix non-SDL build with compilers that fail to respect short-circuiting

This commit is contained in:
Jeffrey Pfau 2015-07-30 23:26:47 -07:00
parent 5a932631be
commit 13fbf3e6e3
3 changed files with 15 additions and 7 deletions

View File

@ -207,10 +207,12 @@ void InputController::setPreferredGamepad(uint32_t type, const QString& device)
}
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) {
return &m_sdlPlayer.rumble.d;
}
#endif
#endif
return nullptr;
}
@ -497,19 +499,29 @@ bool InputController::hasPendingEvent(GBAKey key) const {
return m_pendingEvents.contains(key);
}
#if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0)
void InputController::suspendScreensaver() {
#ifdef BUILD_SDL
#if SDL_VERSION_ATLEAST(2, 0, 0)
GBASDLSuspendScreensaver(&s_sdlEvents);
#endif
#endif
}
void InputController::resumeScreensaver() {
#ifdef BUILD_SDL
#if SDL_VERSION_ATLEAST(2, 0, 0)
GBASDLResumeScreensaver(&s_sdlEvents);
#endif
#endif
}
void InputController::setScreensaverSuspendable(bool suspendable) {
#ifdef BUILD_SDL
#if SDL_VERSION_ATLEAST(2, 0, 0)
GBASDLSetScreensaverSuspendable(&s_sdlEvents, suspendable);
}
#endif
#endif
}
void InputController::stealFocus(QWidget* focus) {
m_focusParent = focus;

View File

@ -87,12 +87,10 @@ signals:
public slots:
void testGamepad(int type);
#if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0)
// TODO: Move these to somewhere that makes sense
void suspendScreensaver();
void resumeScreensaver();
void setScreensaverSuspendable(bool);
#endif
private:
void postPendingEvent(GBAKey);

View File

@ -210,9 +210,7 @@ void Window::loadConfig() {
enterFullScreen();
}
#if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0)
m_inputController.setScreensaverSuspendable(opts->suspendScreensaver);
#endif
m_mruFiles = m_config->getMRU();
updateMRU();