Qt: Fix non-SDL build with compilers that fail to respect short-circuiting
Jeffrey Pfau jeffrey@endrift.com
Thu, 30 Jul 2015 23:26:47 -0700
3 files changed,
15 insertions(+),
7 deletions(-)
M
src/platform/qt/InputController.cpp
→
src/platform/qt/InputController.cpp
@@ -207,10 +207,12 @@ GBAInputSetPreferredDevice(m_config->input(), type, m_playerId, device.toUtf8().constData());
} 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 } -#endif void InputController::stealFocus(QWidget* focus) { m_focusParent = focus;
M
src/platform/qt/InputController.h
→
src/platform/qt/InputController.h
@@ -87,12 +87,10 @@
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);
M
src/platform/qt/Window.cpp
→
src/platform/qt/Window.cpp
@@ -210,9 +210,7 @@ if (opts->fullscreen) {
enterFullScreen(); } -#if defined(BUILD_SDL) && SDL_VERSION_ATLEAST(2, 0, 0) m_inputController.setScreensaverSuspendable(opts->suspendScreensaver); -#endif m_mruFiles = m_config->getMRU(); updateMRU();