all repos — mgba @ 13fbf3e6e36bfc345093b8084ffead856f1fa3e0

mGBA Game Boy Advance Emulator

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
commit

13fbf3e6e36bfc345093b8084ffead856f1fa3e0

parent

5a932631bee45043aabc0eda64858164b91c171e

M src/platform/qt/InputController.cppsrc/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.hsrc/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.cppsrc/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();