diff --git a/CMakeLists.txt b/CMakeLists.txt index 42a50609f..64e29e888 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -585,6 +585,11 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC) endif() endif() + check_c_compiler_flag(-Wundef HAVE_GCC_WUNDEF) + if(HAVE_GCC_WUNDEF) + list(APPEND EXTRA_CFLAGS "-Wundef") + endif() + check_c_compiler_flag(-fno-strict-aliasing HAVE_GCC_NO_STRICT_ALIASING) if(HAVE_GCC_NO_STRICT_ALIASING) list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing") diff --git a/docs/README-ios.md b/docs/README-ios.md index 90ef987a9..94c24b503 100644 --- a/docs/README-ios.md +++ b/docs/README-ios.md @@ -273,7 +273,7 @@ e.g. { ... initialize game ... - #if __IPHONEOS__ + #ifdef __IPHONEOS__ // Initialize the Game Center for scoring and matchmaking InitGameCenter(); diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake index fde90ef4e..2c541ebad 100644 --- a/include/SDL_config.h.cmake +++ b/include/SDL_config.h.cmake @@ -49,7 +49,7 @@ /* Comment this if you want to build without any C library requirements */ #cmakedefine HAVE_LIBC 1 -#if HAVE_LIBC +#ifdef HAVE_LIBC /* Useful headers */ #cmakedefine STDC_HEADERS 1 diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in index 070306a69..38792a10a 100644 --- a/include/SDL_config.h.in +++ b/include/SDL_config.h.in @@ -53,7 +53,7 @@ /* Comment this if you want to build without any C library requirements */ #undef HAVE_LIBC -#if HAVE_LIBC +#ifdef HAVE_LIBC /* Useful headers */ #undef STDC_HEADERS diff --git a/include/SDL_config_winrt.h b/include/SDL_config_winrt.h index 8efde9099..d2f902d09 100644 --- a/include/SDL_config_winrt.h +++ b/include/SDL_config_winrt.h @@ -54,7 +54,7 @@ /* Useful headers */ #define HAVE_DXGI_H 1 -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE #define HAVE_XINPUT_H 1 #endif @@ -161,7 +161,7 @@ #define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE #define SDL_JOYSTICK_DISABLED 1 #define SDL_HAPTIC_DISABLED 1 #else @@ -208,9 +208,9 @@ #define SDL_VIDEO_RENDER_D3D11 1 /* Disable D3D12 as it's not implemented for WinRT */ -#define SDL_VIDEO_RENDER_D3D12 0 +/* #undef SDL_VIDEO_RENDER_D3D12 */ -#if SDL_VIDEO_OPENGL_ES2 +#ifdef SDL_VIDEO_OPENGL_ES2 #define SDL_VIDEO_RENDER_OGL_ES2 1 #endif diff --git a/include/SDL_platform.h b/include/SDL_platform.h index d2a7e052d..2bad24992 100644 --- a/include/SDL_platform.h +++ b/include/SDL_platform.h @@ -166,6 +166,12 @@ #define WINAPI_FAMILY_WINRT 0 #endif /* HAVE_WINAPIFAMILY_H */ +#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP) +#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +#else +#define SDL_WINAPI_FAMILY_PHONE 0 +#endif + #if WINAPI_FAMILY_WINRT #undef __WINRT__ #define __WINRT__ 1 diff --git a/src/SDL.c b/src/SDL.c index 14dbd0326..b46391df3 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -29,7 +29,7 @@ #endif #if defined(__OS2__) #include "core/os2/SDL_os2.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 #include "thread/os2/SDL_systls_c.h" #endif #endif @@ -54,10 +54,10 @@ #include "sensor/SDL_sensor_c.h" /* Initialization/Cleanup routines */ -#if !SDL_TIMERS_DISABLED +#ifndef SDL_TIMERS_DISABLED #include "timer/SDL_timer_c.h" #endif -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS extern int SDL_HelperWindowCreate(void); extern int SDL_HelperWindowDestroy(void); #endif @@ -194,15 +194,15 @@ int SDL_InitSubSystem(Uint32 flags) /* Clear the error message */ SDL_ClearError(); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_Init(); #endif -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */ #endif -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) { if (SDL_HelperWindowCreate() < 0) { goto quit_and_error; @@ -210,13 +210,13 @@ int SDL_InitSubSystem(Uint32 flags) } #endif -#if !SDL_TIMERS_DISABLED +#ifndef SDL_TIMERS_DISABLED SDL_TicksInit(); #endif /* Initialize the event subsystem */ if (flags & SDL_INIT_EVENTS) { -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_EVENTS)) { if (SDL_EventsInit() < 0) { goto quit_and_error; @@ -232,7 +232,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the timer subsystem */ if (flags & SDL_INIT_TIMER) { -#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY +#if !defined(SDL_TIMERS_DISABLED) && !defined(SDL_TIMER_DUMMY) if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) { if (SDL_TimerInit() < 0) { goto quit_and_error; @@ -248,7 +248,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the video subsystem */ if (flags & SDL_INIT_VIDEO) { -#if !SDL_VIDEO_DISABLED +#ifndef SDL_VIDEO_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) { /* video implies events */ if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) { @@ -269,7 +269,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the audio subsystem */ if (flags & SDL_INIT_AUDIO) { -#if !SDL_AUDIO_DISABLED +#ifndef SDL_AUDIO_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) { /* audio implies events */ if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) { @@ -290,7 +290,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the joystick subsystem */ if (flags & SDL_INIT_JOYSTICK) { -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) { /* joystick implies events */ if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) { @@ -310,7 +310,7 @@ int SDL_InitSubSystem(Uint32 flags) } if (flags & SDL_INIT_GAMECONTROLLER) { -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) { /* game controller implies joystick */ if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_JOYSTICK)) { @@ -331,7 +331,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the haptic subsystem */ if (flags & SDL_INIT_HAPTIC) { -#if !SDL_HAPTIC_DISABLED +#ifndef SDL_HAPTIC_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) { if (SDL_HapticInit() < 0) { goto quit_and_error; @@ -347,7 +347,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the sensor subsystem */ if (flags & SDL_INIT_SENSOR) { -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) { if (SDL_SensorInit() < 0) { goto quit_and_error; @@ -378,14 +378,14 @@ int SDL_Init(Uint32 flags) void SDL_QuitSubSystem(Uint32 flags) { #if defined(__OS2__) -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */ #endif SDL_OS2Quit(); #endif /* Shut down requested initialized subsystems */ -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED if (flags & SDL_INIT_SENSOR) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) { SDL_SensorQuit(); @@ -394,7 +394,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (flags & SDL_INIT_GAMECONTROLLER) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) { SDL_GameControllerQuit(); @@ -414,7 +414,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_HAPTIC_DISABLED +#ifndef SDL_HAPTIC_DISABLED if (flags & SDL_INIT_HAPTIC) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) { SDL_HapticQuit(); @@ -423,7 +423,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_AUDIO_DISABLED +#ifndef SDL_AUDIO_DISABLED if (flags & SDL_INIT_AUDIO) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) { SDL_AudioQuit(); @@ -434,7 +434,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_VIDEO_DISABLED +#ifndef SDL_VIDEO_DISABLED if (flags & SDL_INIT_VIDEO) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) { SDL_VideoQuit(); @@ -445,7 +445,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY +#if !defined(SDL_TIMERS_DISABLED) && !defined(SDL_TIMER_DUMMY) if (flags & SDL_INIT_TIMER) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) { SDL_TimerQuit(); @@ -454,7 +454,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (flags & SDL_INIT_EVENTS) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_EVENTS)) { SDL_EventsQuit(); @@ -499,19 +499,19 @@ void SDL_Quit(void) SDL_bInMainQuit = SDL_TRUE; /* Quit all subsystems */ -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS SDL_HelperWindowDestroy(); #endif SDL_QuitSubSystem(SDL_INIT_EVERYTHING); -#if !SDL_TIMERS_DISABLED +#ifndef SDL_TIMERS_DISABLED SDL_TicksQuit(); #endif SDL_ClearHints(); SDL_AssertionsQuit(); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_Quit(); #endif @@ -566,71 +566,71 @@ int SDL_GetRevisionNumber(void) /* Get the name of the platform */ const char *SDL_GetPlatform(void) { -#if __AIX__ +#if defined(__AIX__) return "AIX"; -#elif __ANDROID__ +#elif defined(__ANDROID__) return "Android"; -#elif __BSDI__ +#elif defined(__BSDI__) return "BSDI"; -#elif __DREAMCAST__ +#elif defined(__DREAMCAST__) return "Dreamcast"; -#elif __EMSCRIPTEN__ +#elif defined(__EMSCRIPTEN__) return "Emscripten"; -#elif __FREEBSD__ +#elif defined(__FREEBSD__) return "FreeBSD"; -#elif __HAIKU__ +#elif defined(__HAIKU__) return "Haiku"; -#elif __HPUX__ +#elif defined(__HPUX__) return "HP-UX"; -#elif __IRIX__ +#elif defined(__IRIX__) return "Irix"; -#elif __LINUX__ +#elif defined(__LINUX__) return "Linux"; -#elif __MINT__ +#elif defined(__MINT__) return "Atari MiNT"; -#elif __MACOS__ +#elif defined(__MACOS__) return "MacOS Classic"; -#elif __MACOSX__ +#elif defined(__MACOSX__) return "Mac OS X"; -#elif __NACL__ +#elif defined(__NACL__) return "NaCl"; -#elif __NETBSD__ +#elif defined(__NETBSD__) return "NetBSD"; -#elif __OPENBSD__ +#elif defined(__OPENBSD__) return "OpenBSD"; -#elif __OS2__ +#elif defined(__OS2__) return "OS/2"; -#elif __OSF__ +#elif defined(__OSF__) return "OSF/1"; -#elif __QNXNTO__ +#elif defined(__QNXNTO__) return "QNX Neutrino"; -#elif __RISCOS__ +#elif defined(__RISCOS__) return "RISC OS"; -#elif __SOLARIS__ +#elif defined(__SOLARIS__) return "Solaris"; -#elif __WIN32__ +#elif defined(__WIN32__) return "Windows"; -#elif __WINRT__ +#elif defined(__WINRT__) return "WinRT"; -#elif __WINGDK__ +#elif defined(__WINGDK__) return "WinGDK"; -#elif __XBOXONE__ +#elif defined(__XBOXONE__) return "Xbox One"; -#elif __XBOXSERIES__ +#elif defined(__XBOXSERIES__) return "Xbox Series X|S"; -#elif __TVOS__ +#elif defined(__TVOS__) return "tvOS"; -#elif __IPHONEOS__ +#elif defined(__IPHONEOS__) return "iOS"; -#elif __PS2__ +#elif defined(__PS2__) return "PlayStation 2"; -#elif __PSP__ +#elif defined(__PSP__) return "PlayStation Portable"; -#elif __VITA__ +#elif defined(__VITA__) return "PlayStation Vita"; -#elif __NGAGE__ +#elif defined(__NGAGE__) return "Nokia N-Gage"; -#elif __3DS__ +#elif defined(__3DS__) return "Nintendo 3DS"; #else return "Unknown (see SDL_platform.h)"; @@ -639,10 +639,10 @@ const char *SDL_GetPlatform(void) SDL_bool SDL_IsTablet(void) { -#if __ANDROID__ +#if defined(__ANDROID__) extern SDL_bool SDL_IsAndroidTablet(void); return SDL_IsAndroidTablet(); -#elif __IPHONEOS__ +#elif defined(__IPHONEOS__) extern SDL_bool SDL_IsIPad(void); return SDL_IsIPad(); #else diff --git a/src/SDL_log.c b/src/SDL_log.c index 7fd79378f..b1e3f5819 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -31,7 +31,7 @@ #include "SDL_mutex.h" #include "SDL_log_c.h" -#if HAVE_STDIO_H +#ifdef HAVE_STDIO_H #include #endif @@ -477,10 +477,10 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority } } #endif -#if HAVE_STDIO_H && \ +#if defined(HAVE_STDIO_H) && \ !(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); -#if __NACL__ +#ifdef __NACL__ fflush(stderr); #endif #endif diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index 4e10d52db..ecd815d12 100644 --- a/src/atomic/SDL_atomic.c +++ b/src/atomic/SDL_atomic.c @@ -103,10 +103,10 @@ extern __inline int _SDL_xadd_watcom(volatile int *a, int v); */ #if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS) -#define EMULATE_CAS 1 +#define EMULATE_CAS #endif -#if EMULATE_CAS +#ifdef EMULATE_CAS static SDL_SpinLock locks[32]; static SDL_INLINE void enterLock(void *a) @@ -137,7 +137,7 @@ SDL_bool SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); #elif defined(__SOLARIS__) return (SDL_bool)((int)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval); -#elif EMULATE_CAS +#elif defined(EMULATE_CAS) SDL_bool retval = SDL_FALSE; enterLock(a); @@ -167,7 +167,7 @@ SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval) return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); #elif defined(__SOLARIS__) return (SDL_bool)(atomic_cas_ptr(a, oldval, newval) == oldval); -#elif EMULATE_CAS +#elif defined(EMULATE_CAS) SDL_bool retval = SDL_FALSE; enterLock(a); diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c index 81ff24392..5a55ead9d 100644 --- a/src/atomic/SDL_spinlock.c +++ b/src/atomic/SDL_spinlock.c @@ -63,7 +63,7 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v); /* This function is where all the magic happens... */ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock) { -#if SDL_ATOMIC_DISABLED +#ifdef SDL_ATOMIC_DISABLED /* Terrible terrible damage */ static SDL_mutex *_spinlock_mutex; @@ -81,7 +81,7 @@ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock) return SDL_FALSE; } -#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET +#elif defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET) return __sync_lock_test_and_set(lock, 1) == 0; #elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) @@ -186,7 +186,7 @@ void SDL_AtomicLock(SDL_SpinLock *lock) void SDL_AtomicUnlock(SDL_SpinLock *lock) { -#if HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET +#if defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET) __sync_lock_release(lock); #elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 8480698fe..87e0da5d0 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -36,97 +36,97 @@ static SDL_AudioDevice *open_devices[16]; /* Available audio drivers */ static const AudioBootStrap *const bootstrap[] = { -#if SDL_AUDIO_DRIVER_PULSEAUDIO +#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO &PULSEAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_ALSA +#ifdef SDL_AUDIO_DRIVER_ALSA &ALSA_bootstrap, #endif -#if SDL_AUDIO_DRIVER_SNDIO +#ifdef SDL_AUDIO_DRIVER_SNDIO &SNDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_NETBSD +#ifdef SDL_AUDIO_DRIVER_NETBSD &NETBSDAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_QSA +#ifdef SDL_AUDIO_DRIVER_QSA &QSAAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_SUNAUDIO +#ifdef SDL_AUDIO_DRIVER_SUNAUDIO &SUNAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_ARTS +#ifdef SDL_AUDIO_DRIVER_ARTS &ARTS_bootstrap, #endif -#if SDL_AUDIO_DRIVER_ESD +#ifdef SDL_AUDIO_DRIVER_ESD &ESD_bootstrap, #endif -#if SDL_AUDIO_DRIVER_NACL +#ifdef SDL_AUDIO_DRIVER_NACL &NACLAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_NAS +#ifdef SDL_AUDIO_DRIVER_NAS &NAS_bootstrap, #endif -#if SDL_AUDIO_DRIVER_WASAPI +#ifdef SDL_AUDIO_DRIVER_WASAPI &WASAPI_bootstrap, #endif -#if SDL_AUDIO_DRIVER_DSOUND +#ifdef SDL_AUDIO_DRIVER_DSOUND &DSOUND_bootstrap, #endif -#if SDL_AUDIO_DRIVER_WINMM +#ifdef SDL_AUDIO_DRIVER_WINMM &WINMM_bootstrap, #endif -#if SDL_AUDIO_DRIVER_PAUDIO +#ifdef SDL_AUDIO_DRIVER_PAUDIO &PAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_HAIKU +#ifdef SDL_AUDIO_DRIVER_HAIKU &HAIKUAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_COREAUDIO +#ifdef SDL_AUDIO_DRIVER_COREAUDIO &COREAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_FUSIONSOUND +#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND &FUSIONSOUND_bootstrap, #endif -#if SDL_AUDIO_DRIVER_AAUDIO +#ifdef SDL_AUDIO_DRIVER_AAUDIO &aaudio_bootstrap, #endif -#if SDL_AUDIO_DRIVER_OPENSLES +#ifdef SDL_AUDIO_DRIVER_OPENSLES &openslES_bootstrap, #endif -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID &ANDROIDAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_PS2 +#ifdef SDL_AUDIO_DRIVER_PS2 &PS2AUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_PSP +#ifdef SDL_AUDIO_DRIVER_PSP &PSPAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_VITA +#ifdef SDL_AUDIO_DRIVER_VITA &VITAAUD_bootstrap, #endif -#if SDL_AUDIO_DRIVER_N3DS +#ifdef SDL_AUDIO_DRIVER_N3DS &N3DSAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_EMSCRIPTEN +#ifdef SDL_AUDIO_DRIVER_EMSCRIPTEN &EMSCRIPTENAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_JACK +#ifdef SDL_AUDIO_DRIVER_JACK &JACK_bootstrap, #endif -#if SDL_AUDIO_DRIVER_PIPEWIRE +#ifdef SDL_AUDIO_DRIVER_PIPEWIRE &PIPEWIRE_bootstrap, #endif -#if SDL_AUDIO_DRIVER_OSS +#ifdef SDL_AUDIO_DRIVER_OSS &DSP_bootstrap, #endif -#if SDL_AUDIO_DRIVER_OS2 +#ifdef SDL_AUDIO_DRIVER_OS2 &OS2AUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_DISK +#ifdef SDL_AUDIO_DRIVER_DISK &DISKAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_DUMMY +#ifdef SDL_AUDIO_DRIVER_DUMMY &DUMMYAUDIO_bootstrap, #endif NULL @@ -658,7 +658,7 @@ void SDL_ClearQueuedAudio(SDL_AudioDeviceID devid) current_audio.impl.UnlockDevice(device); } -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID extern void Android_JNI_AudioSetThreadPriority(int, int); #endif @@ -673,7 +673,7 @@ static int SDLCALL SDL_RunAudio(void *devicep) SDL_assert(!device->iscapture); -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID { /* Set thread priority to THREAD_PRIORITY_AUDIO */ Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); @@ -773,7 +773,7 @@ static int SDLCALL SDL_CaptureAudio(void *devicep) SDL_assert(device->iscapture); -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID { /* Set thread priority to THREAD_PRIORITY_AUDIO */ Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); @@ -932,7 +932,7 @@ int SDL_AudioInit(const char *driver_name) const char *driver_attempt_end = SDL_strchr(driver_attempt, ','); size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt) : SDL_strlen(driver_attempt); -#if SDL_AUDIO_DRIVER_DSOUND +#ifdef SDL_AUDIO_DRIVER_DSOUND /* SDL 1.2 uses the name "dsound", so we'll support both. */ if (driver_attempt_len == SDL_strlen("dsound") && (SDL_strncasecmp(driver_attempt, "dsound", driver_attempt_len) == 0)) { @@ -941,7 +941,7 @@ int SDL_AudioInit(const char *driver_name) } #endif -#if SDL_AUDIO_DRIVER_PULSEAUDIO +#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO /* SDL 1.2 uses the name "pulse", so we'll support both. */ if (driver_attempt_len == SDL_strlen("pulse") && (SDL_strncasecmp(driver_attempt, "pulse", driver_attempt_len) == 0)) { diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index bf6665df5..5954932f4 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -93,7 +93,7 @@ * 8 channels (7.1) layout: FL+FR+FC+LFE+BL+BR+SL+SR */ -#if HAVE_SSE3_INTRINSICS +#ifdef HAVE_SSE3_INTRINSICS /* Convert from stereo to mono. Average left and right. */ static void SDLCALL SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFormat format) { @@ -130,7 +130,7 @@ static void SDLCALL SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFor } #endif -#if HAVE_SSE_INTRINSICS +#ifdef HAVE_SSE_INTRINSICS /* Convert from mono to stereo. Duplicate to stereo left and right. */ static void SDLCALL SDL_ConvertMonoToStereo_SSE(SDL_AudioCVT *cvt, SDL_AudioFormat format) { @@ -473,10 +473,12 @@ static void SDL_ResampleCVT_SRC(SDL_AudioCVT *cvt, const int chans, const SDL_Au result = SRC_src_simple(&data, SRC_converter, chans); /* Simple API converts the whole buffer at once. No need for initialization. */ /* !!! FIXME: Handle library failures? */ -#ifdef DEBUG_CONVERT +#if DEBUG_CONVERT if (result != 0) { SDL_Log("src_simple() failed: %s", SRC_src_strerror(result)); } +#else + (void)result; #endif cvt->len_cvt = data.output_frames_gen * framelen; @@ -789,7 +791,7 @@ int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, /* swap in some SIMD versions for a few of these. */ if (channel_converter == SDL_ConvertStereoToMono) { SDL_AudioFilter filter = NULL; -#if HAVE_SSE3_INTRINSICS +#ifdef HAVE_SSE3_INTRINSICS if (!filter && SDL_HasSSE3()) { filter = SDL_ConvertStereoToMono_SSE3; } @@ -799,7 +801,7 @@ int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, } } else if (channel_converter == SDL_ConvertMonoToStereo) { SDL_AudioFilter filter = NULL; -#if HAVE_SSE_INTRINSICS +#ifdef HAVE_SSE_INTRINSICS if (!filter && SDL_HasSSE()) { filter = SDL_ConvertMonoToStereo_SSE; } diff --git a/src/audio/SDL_audiodev.c b/src/audio/SDL_audiodev.c index fb2fb9904..0f39b7da8 100644 --- a/src/audio/SDL_audiodev.c +++ b/src/audio/SDL_audiodev.c @@ -22,7 +22,7 @@ /* Get the name of the audio device we use for output */ -#if SDL_AUDIO_DRIVER_NETBSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO +#if defined(SDL_AUDIO_DRIVER_NETBSD) || defined(SDL_AUDIO_DRIVER_OSS) || defined(SDL_AUDIO_DRIVER_SUNAUDIO) #include #include diff --git a/src/audio/SDL_audiotypecvt.c b/src/audio/SDL_audiotypecvt.c index 7ffa4dd19..14916d077 100644 --- a/src/audio/SDL_audiotypecvt.c +++ b/src/audio/SDL_audiotypecvt.c @@ -29,16 +29,16 @@ #endif #ifdef __SSE2__ -#define HAVE_SSE2_INTRINSICS 1 +#define HAVE_SSE2_INTRINSICS #endif -#if defined(__x86_64__) && HAVE_SSE2_INTRINSICS +#if defined(__x86_64__) && defined(HAVE_SSE2_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */ -#elif __MACOSX__ && HAVE_SSE2_INTRINSICS +#elif defined(__MACOSX__) && defined(HAVE_SSE2_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* Mac OS X/Intel guarantees SSE2. */ -#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && HAVE_NEON_INTRINSICS +#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && defined(HAVE_NEON_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */ -#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && HAVE_NEON_INTRINSICS +#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(HAVE_NEON_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */ #endif @@ -278,7 +278,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo } #endif -#if HAVE_SSE2_INTRINSICS +#ifdef HAVE_SSE2_INTRINSICS static void SDLCALL SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1; @@ -874,7 +874,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm } #endif -#if HAVE_NEON_INTRINSICS +#ifdef HAVE_NEON_INTRINSICS static void SDLCALL SDL_Convert_S8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) { const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1; @@ -1463,14 +1463,14 @@ void SDL_ChooseAudioConverters(void) SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \ converters_chosen = SDL_TRUE -#if HAVE_SSE2_INTRINSICS +#ifdef HAVE_SSE2_INTRINSICS if (SDL_HasSSE2()) { SET_CONVERTER_FUNCS(SSE2); return; } #endif -#if HAVE_NEON_INTRINSICS +#ifdef HAVE_NEON_INTRINSICS if (SDL_HasNEON()) { SET_CONVERTER_FUNCS(NEON); return; diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c index 535c8e2df..122de11d7 100644 --- a/src/audio/aaudio/SDL_aaudio.c +++ b/src/audio/aaudio/SDL_aaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_AAUDIO +#ifdef SDL_AUDIO_DRIVER_AAUDIO #include "SDL_audio.h" #include "SDL_loadso.h" diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index 60238b8f7..9c26362bd 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_ALSA +#ifdef SDL_AUDIO_DRIVER_ALSA #ifndef SDL_ALSA_NON_BLOCKING #define SDL_ALSA_NON_BLOCKING 0 diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c index ab570e55a..6e9eaa402 100644 --- a/src/audio/android/SDL_androidaudio.c +++ b/src/audio/android/SDL_androidaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID /* Output audio to Android */ diff --git a/src/audio/arts/SDL_artsaudio.c b/src/audio/arts/SDL_artsaudio.c index 632df6fe7..7f2837906 100644 --- a/src/audio/arts/SDL_artsaudio.c +++ b/src/audio/arts/SDL_artsaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_ARTS +#ifdef SDL_AUDIO_DRIVER_ARTS /* Allow access to a raw mixing buffer */ diff --git a/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h index 08b8cfbbc..d92fc419b 100644 --- a/src/audio/coreaudio/SDL_coreaudio.h +++ b/src/audio/coreaudio/SDL_coreaudio.h @@ -26,10 +26,10 @@ #include "../SDL_sysaudio.h" #if !defined(__IPHONEOS__) -#define MACOSX_COREAUDIO 1 +#define MACOSX_COREAUDIO #endif -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO #include #else #import @@ -40,7 +40,7 @@ #include /* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */ -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO #include #ifndef MAC_OS_VERSION_12_0 #define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster @@ -62,7 +62,7 @@ struct SDL_PrivateAudioData AudioStreamBasicDescription strdesc; SDL_sem *ready_semaphore; char *thread_error; -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO AudioDeviceID deviceID; SDL_atomic_t device_change_flag; #else diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 4fb9b7882..a59bd8a63 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_COREAUDIO +#ifdef SDL_AUDIO_DRIVER_COREAUDIO /* !!! FIXME: clean out some of the macro salsa in here. */ @@ -48,7 +48,7 @@ } #endif -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO static const AudioObjectPropertyAddress devlist_address = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, @@ -289,7 +289,7 @@ static int open_capture_devices; static int num_open_devices; static SDL_AudioDevice **open_devices; -#if !MACOSX_COREAUDIO +#ifndef MACOSX_COREAUDIO static BOOL session_active = NO; @@ -630,7 +630,7 @@ static void inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBuffer AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); } -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO static const AudioObjectPropertyAddress alive_address = { kAudioDevicePropertyDeviceIsAlive, kAudioObjectPropertyScopeGlobal, @@ -684,7 +684,7 @@ static void COREAUDIO_CloseDevice(_THIS) /* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */ /* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */ -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if (this->handle != NULL) { /* we don't register this listener for default devices. */ AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); } @@ -711,7 +711,7 @@ static void COREAUDIO_CloseDevice(_THIS) open_playback_devices--; } -#if !MACOSX_COREAUDIO +#ifndef MACOSX_COREAUDIO update_audio_session(this, SDL_FALSE, SDL_TRUE); #endif @@ -740,7 +740,7 @@ static void COREAUDIO_CloseDevice(_THIS) SDL_free(this->hidden); } -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO static int prepare_device(_THIS) { void *handle = this->handle; @@ -833,7 +833,7 @@ static int prepare_audioqueue(_THIS) CHECK_RESULT("AudioQueueNewOutput"); } -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if (!assign_device_to_audioqueue(this)) { return 0; } @@ -941,7 +941,7 @@ static int audioqueue_thread(void *arg) SDL_AudioDevice *this = (SDL_AudioDevice *)arg; int rc; -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO const AudioObjectPropertyAddress default_device_address = { this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, @@ -969,7 +969,7 @@ static int audioqueue_thread(void *arg) while (!SDL_AtomicGet(&this->shutdown)) { CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if ((this->handle == NULL) && SDL_AtomicGet(&this->hidden->device_change_flag)) { const AudioDeviceID prev_devid = this->hidden->deviceID; SDL_AtomicSet(&this->hidden->device_change_flag, 0); @@ -1002,7 +1002,7 @@ static int audioqueue_thread(void *arg) CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0); } -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if (this->handle == NULL) { /* we don't care if this fails; we just won't change to new default devices, but we still otherwise function in this case. */ AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &default_device_address, default_device_changed, this); @@ -1040,7 +1040,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname) open_devices[num_open_devices++] = this; } -#if !MACOSX_COREAUDIO +#ifndef MACOSX_COREAUDIO if (!update_audio_session(this, SDL_TRUE, SDL_TRUE)) { return -1; } @@ -1109,7 +1109,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname) strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8; strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket; -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if (!prepare_device(this)) { return -1; } @@ -1137,7 +1137,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname) return (this->hidden->thread != NULL) ? 0 : -1; } -#if !MACOSX_COREAUDIO +#ifndef MACOSX_COREAUDIO static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) { AVAudioSession *session = [AVAudioSession sharedInstance]; @@ -1275,7 +1275,7 @@ static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int i static void COREAUDIO_Deinitialize(void) { -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); free_audio_device_list(&capture_devs); free_audio_device_list(&output_devs); @@ -1290,7 +1290,7 @@ static SDL_bool COREAUDIO_Init(SDL_AudioDriverImpl *impl) impl->Deinitialize = COREAUDIO_Deinitialize; impl->GetDefaultAudioInfo = COREAUDIO_GetDefaultAudioInfo; -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO impl->DetectDevices = COREAUDIO_DetectDevices; AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); #else diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index 5d5225e2a..f9e7d26f3 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_DSOUND +#ifdef SDL_AUDIO_DRIVER_DSOUND /* Allow access to a raw mixing buffer */ @@ -30,7 +30,7 @@ #include "../SDL_audio_c.h" #include "SDL_directsound.h" #include -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H #include "../../core/windows/SDL_immdevice.h" #endif /* HAVE_MMDEVICEAPI_H */ @@ -39,7 +39,7 @@ #endif /* For Vista+, we can enumerate DSound devices with IMMDevice */ -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H static SDL_bool SupportsIMMDevice = SDL_FALSE; #endif /* HAVE_MMDEVICEAPI_H */ @@ -159,7 +159,7 @@ static void DSOUND_FreeDeviceHandle(void *handle) static int DSOUND_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) { -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H if (SupportsIMMDevice) { return SDL_IMMDevice_GetDefaultAudioInfo(name, spec, iscapture); } @@ -189,14 +189,14 @@ static BOOL CALLBACK FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVO static void DSOUND_DetectDevices(void) { -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H if (SupportsIMMDevice) { SDL_IMMDevice_EnumerateEndpoints(SDL_TRUE); } else { #endif /* HAVE_MMDEVICEAPI_H */ pDirectSoundCaptureEnumerateW(FindAllDevs, (void *)((size_t)1)); pDirectSoundEnumerateW(FindAllDevs, (void *)((size_t)0)); -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H } #endif /* HAVE_MMDEVICEAPI_H*/ } @@ -612,7 +612,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname) static void DSOUND_Deinitialize(void) { -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H if (SupportsIMMDevice) { SDL_IMMDevice_Quit(); SupportsIMMDevice = SDL_FALSE; @@ -627,7 +627,7 @@ static SDL_bool DSOUND_Init(SDL_AudioDriverImpl *impl) return SDL_FALSE; } -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H SupportsIMMDevice = !(SDL_IMMDevice_Init() < 0); #endif /* HAVE_MMDEVICEAPI_H */ diff --git a/src/audio/disk/SDL_diskaudio.c b/src/audio/disk/SDL_diskaudio.c index cd37e53bb..675c42044 100644 --- a/src/audio/disk/SDL_diskaudio.c +++ b/src/audio/disk/SDL_diskaudio.c @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_DISK +#ifdef SDL_AUDIO_DRIVER_DISK /* Output raw audio data to a file. */ -#if HAVE_STDIO_H +#ifdef HAVE_STDIO_H #include #endif diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index cb8bb7a68..b2514fdde 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/src/audio/dsp/SDL_dspaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_OSS +#ifdef SDL_AUDIO_DRIVER_OSS /* Allow access to a raw mixing buffer */ diff --git a/src/audio/dummy/SDL_dummyaudio.c b/src/audio/dummy/SDL_dummyaudio.c index 9255e28a6..1cc35a5b6 100644 --- a/src/audio/dummy/SDL_dummyaudio.c +++ b/src/audio/dummy/SDL_dummyaudio.c @@ -20,6 +20,8 @@ */ #include "../../SDL_internal.h" +#ifdef SDL_AUDIO_DRIVER_DUMMY + /* Output audio to nowhere... */ #include "SDL_timer.h" @@ -61,4 +63,6 @@ AudioBootStrap DUMMYAUDIO_bootstrap = { "dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE }; +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c index a89d34fd8..a5390fbd8 100644 --- a/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/src/audio/emscripten/SDL_emscriptenaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_EMSCRIPTEN +#ifdef SDL_AUDIO_DRIVER_EMSCRIPTEN #include "SDL_audio.h" #include "../SDL_audio_c.h" diff --git a/src/audio/esd/SDL_esdaudio.c b/src/audio/esd/SDL_esdaudio.c index c2ad33ba8..88a98d15e 100644 --- a/src/audio/esd/SDL_esdaudio.c +++ b/src/audio/esd/SDL_esdaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_ESD +#ifdef SDL_AUDIO_DRIVER_ESD /* Allow access to an ESD network stream mixing buffer */ diff --git a/src/audio/fusionsound/SDL_fsaudio.c b/src/audio/fusionsound/SDL_fsaudio.c index 077fa57c8..80023f57b 100644 --- a/src/audio/fusionsound/SDL_fsaudio.c +++ b/src/audio/fusionsound/SDL_fsaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_FUSIONSOUND +#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND /* !!! FIXME: why is this is SDL_FS_* instead of FUSIONSOUND_*? */ diff --git a/src/audio/haiku/SDL_haikuaudio.cc b/src/audio/haiku/SDL_haikuaudio.cc index 02678ff19..67b472d56 100644 --- a/src/audio/haiku/SDL_haikuaudio.cc +++ b/src/audio/haiku/SDL_haikuaudio.cc @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_HAIKU +#ifdef SDL_AUDIO_DRIVER_HAIKU /* Allow access to the audio stream on Haiku */ diff --git a/src/audio/jack/SDL_jackaudio.c b/src/audio/jack/SDL_jackaudio.c index 94ea12dc5..3866c48e6 100644 --- a/src/audio/jack/SDL_jackaudio.c +++ b/src/audio/jack/SDL_jackaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_JACK +#ifdef SDL_AUDIO_DRIVER_JACK #include "SDL_timer.h" #include "SDL_audio.h" diff --git a/src/audio/nacl/SDL_naclaudio.c b/src/audio/nacl/SDL_naclaudio.c index 36ef6a0f1..ae8932383 100644 --- a/src/audio/nacl/SDL_naclaudio.c +++ b/src/audio/nacl/SDL_naclaudio.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_NACL +#ifdef SDL_AUDIO_DRIVER_NACL #include "SDL_naclaudio.h" diff --git a/src/audio/nas/SDL_nasaudio.c b/src/audio/nas/SDL_nasaudio.c index 0362cd606..c6ec062ca 100644 --- a/src/audio/nas/SDL_nasaudio.c +++ b/src/audio/nas/SDL_nasaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_NAS +#ifdef SDL_AUDIO_DRIVER_NAS /* Allow access to a raw mixing buffer */ diff --git a/src/audio/netbsd/SDL_netbsdaudio.c b/src/audio/netbsd/SDL_netbsdaudio.c index 42e638d6b..4b66c020b 100644 --- a/src/audio/netbsd/SDL_netbsdaudio.c +++ b/src/audio/netbsd/SDL_netbsdaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_NETBSD +#ifdef SDL_AUDIO_DRIVER_NETBSD /* * Driver for native NetBSD audio(4). diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c index 41f9ba148..0c13ade17 100644 --- a/src/audio/openslES/SDL_openslES.c +++ b/src/audio/openslES/SDL_openslES.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_OPENSLES +#ifdef SDL_AUDIO_DRIVER_OPENSLES /* For more discussion of low latency audio on Android, see this: https://googlesamples.github.io/android-audio-high-performance/guides/opensl_es.html diff --git a/src/audio/os2/SDL_os2audio.c b/src/audio/os2/SDL_os2audio.c index 9eaa21d08..8698983e9 100644 --- a/src/audio/os2/SDL_os2audio.c +++ b/src/audio/os2/SDL_os2audio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_OS2 +#ifdef SDL_AUDIO_DRIVER_OS2 /* Allow access to a raw mixing buffer */ diff --git a/src/audio/paudio/SDL_paudio.c b/src/audio/paudio/SDL_paudio.c index 266cadd1d..3b6c26368 100644 --- a/src/audio/paudio/SDL_paudio.c +++ b/src/audio/paudio/SDL_paudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_PAUDIO +#ifdef SDL_AUDIO_DRIVER_PAUDIO /* Allow access to a raw mixing buffer */ diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c index aa713f004..358740d98 100644 --- a/src/audio/pipewire/SDL_pipewire.c +++ b/src/audio/pipewire/SDL_pipewire.c @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" #include "SDL_hints.h" -#if SDL_AUDIO_DRIVER_PIPEWIRE +#ifdef SDL_AUDIO_DRIVER_PIPEWIRE #include "SDL_audio.h" #include "SDL_loadso.h" diff --git a/src/audio/psp/SDL_pspaudio.c b/src/audio/psp/SDL_pspaudio.c index c19a4b8aa..fc9781f1e 100644 --- a/src/audio/psp/SDL_pspaudio.c +++ b/src/audio/psp/SDL_pspaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_PSP +#ifdef SDL_AUDIO_DRIVER_PSP #include #include diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c index 339106df5..d0fd5fed0 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/audio/pulseaudio/SDL_pulseaudio.c @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" #include "SDL_hints.h" -#if SDL_AUDIO_DRIVER_PULSEAUDIO +#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO /* Allow access to a raw mixing buffer */ diff --git a/src/audio/qsa/SDL_qsa_audio.c b/src/audio/qsa/SDL_qsa_audio.c index 893eb4ea8..c997c7a60 100644 --- a/src/audio/qsa/SDL_qsa_audio.c +++ b/src/audio/qsa/SDL_qsa_audio.c @@ -30,7 +30,7 @@ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_QSA +#ifdef SDL_AUDIO_DRIVER_QSA #include #include diff --git a/src/audio/sndio/SDL_sndioaudio.c b/src/audio/sndio/SDL_sndioaudio.c index 03cc6e68e..a0cbde0b9 100644 --- a/src/audio/sndio/SDL_sndioaudio.c +++ b/src/audio/sndio/SDL_sndioaudio.c @@ -21,11 +21,11 @@ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_SNDIO +#ifdef SDL_AUDIO_DRIVER_SNDIO /* OpenBSD sndio target */ -#if HAVE_STDIO_H +#ifdef HAVE_STDIO_H #include #endif diff --git a/src/audio/sun/SDL_sunaudio.c b/src/audio/sun/SDL_sunaudio.c index 2c15b479d..df61fe16c 100644 --- a/src/audio/sun/SDL_sunaudio.c +++ b/src/audio/sun/SDL_sunaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_SUNAUDIO +#ifdef SDL_AUDIO_DRIVER_SUNAUDIO /* Allow access to a raw mixing buffer */ @@ -281,7 +281,7 @@ static int SUNAUDIO_OpenDevice(_THIS, const char *devname) break; /* try again */ case AUDIO_ENCODING_LINEAR: - /* linear 16bit didn't work either, resort to -law */ + /* linear 16bit didn't work either, resort to �-law */ enc = AUDIO_ENCODING_ULAW; this->spec.channels = 1; this->spec.freq = 8000; diff --git a/src/audio/vita/SDL_vitaaudio.c b/src/audio/vita/SDL_vitaaudio.c index 018cf0ab5..8e0b27d74 100644 --- a/src/audio/vita/SDL_vitaaudio.c +++ b/src/audio/vita/SDL_vitaaudio.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_VITA +#ifdef SDL_AUDIO_DRIVER_VITA #include #include diff --git a/src/audio/wasapi/SDL_wasapi.c b/src/audio/wasapi/SDL_wasapi.c index 1d66a3831..60b9618cc 100644 --- a/src/audio/wasapi/SDL_wasapi.c +++ b/src/audio/wasapi/SDL_wasapi.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_WASAPI +#ifdef SDL_AUDIO_DRIVER_WASAPI #include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_immdevice.h" diff --git a/src/audio/wasapi/SDL_wasapi_win32.c b/src/audio/wasapi/SDL_wasapi_win32.c index 965e7ff69..62e19e192 100644 --- a/src/audio/wasapi/SDL_wasapi_win32.c +++ b/src/audio/wasapi/SDL_wasapi_win32.c @@ -26,7 +26,7 @@ The code in SDL_wasapi.c is used by both standard Windows and WinRT builds to deal with audio and calls into these functions. */ -#if SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) +#if defined(SDL_AUDIO_DRIVER_WASAPI) && !defined(__WINRT__) #include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_immdevice.h" diff --git a/src/audio/wasapi/SDL_wasapi_winrt.cpp b/src/audio/wasapi/SDL_wasapi_winrt.cpp index aa0130012..c420422ab 100644 --- a/src/audio/wasapi/SDL_wasapi_winrt.cpp +++ b/src/audio/wasapi/SDL_wasapi_winrt.cpp @@ -25,7 +25,7 @@ // is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard // Windows and WinRT builds to deal with audio and calls into these functions. -#if SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) +#if defined(SDL_AUDIO_DRIVER_WASAPI) && defined(__WINRT__) #include #include diff --git a/src/audio/winmm/SDL_winmm.c b/src/audio/winmm/SDL_winmm.c index d3c5b1ba6..e293e3ac2 100644 --- a/src/audio/winmm/SDL_winmm.c +++ b/src/audio/winmm/SDL_winmm.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_WINMM +#ifdef SDL_AUDIO_DRIVER_WINMM /* Allow access to a raw mixing buffer */ diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 2886f1094..d0ca01747 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -1056,7 +1056,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j { SDL_LockMutex(Android_ActivityMutex); -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (Android_Window) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_WindowData *data = (SDL_WindowData *)Android_Window->driverdata; @@ -1098,7 +1098,7 @@ retry: } } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index b82ac11df..a9f2146ed 100644 --- a/src/core/linux/SDL_dbus.c +++ b/src/core/linux/SDL_dbus.c @@ -25,7 +25,7 @@ #include "SDL_sandbox.h" #include "../../stdlib/SDL_vacopy.h" -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* we never link directly to libdbus. */ #include "SDL_loadso.h" static const char *dbus_library = "libdbus-1.so.3"; diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index e8ae6ccff..9027c11c8 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -130,7 +130,7 @@ static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item); static int SDL_EVDEV_device_removed(const char *dev_path); static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char *dev_path); #endif /* SDL_USE_LIBUDEV */ @@ -168,7 +168,7 @@ int SDL_EVDEV_Init(void) return SDL_OutOfMemory(); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (SDL_UDEV_Init() < 0) { SDL_free(_this); _this = NULL; @@ -233,7 +233,7 @@ void SDL_EVDEV_Quit(void) _this->ref_count -= 1; if (_this->ref_count < 1) { -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ @@ -254,7 +254,7 @@ void SDL_EVDEV_Quit(void) } } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char *dev_path) { @@ -318,7 +318,7 @@ void SDL_EVDEV_Poll(void) return; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_Poll(); #endif diff --git a/src/core/linux/SDL_evdev_capabilities.c b/src/core/linux/SDL_evdev_capabilities.c index b8f112b51..fb4f85911 100644 --- a/src/core/linux/SDL_evdev_capabilities.c +++ b/src/core/linux/SDL_evdev_capabilities.c @@ -23,7 +23,7 @@ #include "SDL_evdev_capabilities.h" -#if HAVE_LINUX_INPUT_H +#ifdef HAVE_LINUX_INPUT_H /* missing defines in older Linux kernel headers */ #ifndef BTN_TRIGGER_HAPPY diff --git a/src/core/linux/SDL_evdev_capabilities.h b/src/core/linux/SDL_evdev_capabilities.h index 8fcdcb686..5163255d6 100644 --- a/src/core/linux/SDL_evdev_capabilities.h +++ b/src/core/linux/SDL_evdev_capabilities.h @@ -24,7 +24,7 @@ #ifndef SDL_evdev_capabilities_h_ #define SDL_evdev_capabilities_h_ -#if HAVE_LINUX_INPUT_H +#ifdef HAVE_LINUX_INPUT_H #include diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c index a0e13ee19..b12c6ceaf 100644 --- a/src/core/linux/SDL_fcitx.c +++ b/src/core/linux/SDL_fcitx.c @@ -28,7 +28,7 @@ #include "../../events/SDL_keyboard_c.h" #include "SDL_dbus.h" #include "SDL_syswm.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 # include "../../video/x11/SDL_x11video.h" #endif #include "SDL_hints.h" @@ -449,7 +449,7 @@ void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect) SDL_GetWindowPosition(focused_win, &x, &y); -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 if (info.subsystem == SDL_SYSWM_X11) { SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index e6b6eb82e..4bbc6aedb 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -29,7 +29,7 @@ #include "../../video/SDL_sysvideo.h" #include "../../events/SDL_keyboard_c.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "../../video/x11/SDL_x11video.h" #endif @@ -723,7 +723,7 @@ void SDL_IBus_UpdateTextRect(const SDL_Rect *rect) SDL_GetWindowPosition(focused_win, &x, &y); -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 if (info.subsystem == SDL_SYSWM_X11) { SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; diff --git a/src/core/linux/SDL_threadprio.c b/src/core/linux/SDL_threadprio.c index 9bbc7d54f..400ea1211 100644 --- a/src/core/linux/SDL_threadprio.c +++ b/src/core/linux/SDL_threadprio.c @@ -26,7 +26,7 @@ #include "SDL_stdinc.h" #include "SDL_thread.h" -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED #include #include #include @@ -44,7 +44,7 @@ #include "SDL_dbus.h" -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS #include /* d-bus queries to org.freedesktop.RealtimeKit1. */ @@ -256,14 +256,14 @@ static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority) /* this is a public symbol, so it has to exist even if threads are disabled. */ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return SDL_Unsupported(); #else if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) { return 0; } -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* Note that this fails you most likely: * Have your process's scheduler incorrectly configured. See the requirements at: @@ -288,7 +288,7 @@ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) /* this is a public symbol, so it has to exist even if threads are disabled. */ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return SDL_Unsupported(); #else int osPriority; @@ -319,7 +319,7 @@ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int sc } } -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* Note that this fails you most likely: * Have your process's scheduler incorrectly configured. See the requirements at: diff --git a/src/core/linux/SDL_udev.h b/src/core/linux/SDL_udev.h index b8920b71c..2011d1835 100644 --- a/src/core/linux/SDL_udev.h +++ b/src/core/linux/SDL_udev.h @@ -24,7 +24,7 @@ #ifndef SDL_udev_h_ #define SDL_udev_h_ -#if HAVE_LIBUDEV_H && HAVE_LINUX_INPUT_H +#if defined(HAVE_LIBUDEV_H) && defined(HAVE_LINUX_INPUT_H) #ifndef SDL_USE_LIBUDEV #define SDL_USE_LIBUDEV 1 diff --git a/src/core/os2/geniconv/test.c b/src/core/os2/geniconv/test.c index 2214b9789..0ccb6a88b 100644 --- a/src/core/os2/geniconv/test.c +++ b/src/core/os2/geniconv/test.c @@ -27,7 +27,7 @@ int main(void) { char acBuf[128]; - char *inbuf = " - "; /* KOI8-R string */ + char *inbuf = "\xf4\xc5\xd3\xd4\x20\x2d\x20\xd0\xd2\xcf\xd7\xc5\xd2\xcb\xc1"; /* KOI8-R encoding of "Тест - проверка" */ size_t inbytesleft = strlen(inbuf); char *outbuf = acBuf; size_t outbytesleft = sizeof(acBuf); diff --git a/src/core/windows/SDL_immdevice.c b/src/core/windows/SDL_immdevice.c index f8d893170..b7e6fd635 100644 --- a/src/core/windows/SDL_immdevice.c +++ b/src/core/windows/SDL_immdevice.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if (defined(__WIN32__) || defined(__GDK__)) && HAVE_MMDEVICEAPI_H +#if (defined(__WIN32__) || defined(__GDK__)) && defined(HAVE_MMDEVICEAPI_H) #include "SDL_windows.h" #include "SDL_immdevice.h" diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp index 3b7280b3d..0fd014ebb 100644 --- a/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -39,7 +39,7 @@ using namespace Windows::System; using namespace Windows::UI::Core; using namespace Windows::UI::Input; -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE using namespace Windows::Phone::UI::Input; #endif @@ -64,7 +64,7 @@ extern "C" { #include "SDL_winrtapp_common.h" #include "SDL_winrtapp_direct3d.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) /* Calling IDXGIDevice3::Trim on the active Direct3D 11.x device is necessary * when Windows 8.1 apps are about to get suspended. */ @@ -126,7 +126,7 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8) +#if SDL_WINAPI_FAMILY_PHONE && (NTDDI_VERSION == NTDDI_WIN8) /* WinPhone 8.0 always keeps its native window size in portrait, regardless of orientation. This changes in WinPhone 8.1, in which the native window's size changes along with @@ -227,7 +227,7 @@ void SDL_WinRTApp::OnOrientationChanged(Object ^ sender) WINRT_ProcessWindowSizeChange(); -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE // HACK: Make sure that orientation changes // lead to the Direct3D renderer's viewport getting updated: // @@ -273,7 +273,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window) window->Closed += ref new TypedEventHandler(this, &SDL_WinRTApp::OnWindowClosed); -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); #endif @@ -295,7 +295,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window) window->PointerWheelChanged += ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerWheelChanged); -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE // Retrieves relative-only mouse movements: Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved += ref new TypedEventHandler(this, &SDL_WinRTApp::OnMouseMoved); @@ -313,7 +313,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window) #if NTDDI_VERSION >= NTDDI_WIN10 Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += ref new EventHandler(this, &SDL_WinRTApp::OnBackButtonPressed); -#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#elif SDL_WINAPI_FAMILY_PHONE HardwareButtons::BackPressed += ref new EventHandler(this, &SDL_WinRTApp::OnBackButtonPressed); #endif @@ -555,7 +555,7 @@ void SDL_WinRTApp::OnWindowActivated(CoreWindow ^ sender, WindowActivatedEventAr Don't do it on WinPhone 8.0 though, as CoreWindow's 'PointerPosition' property isn't available. */ -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION >= NTDDI_WINBLUE) +#if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION >= NTDDI_WINBLUE) Point cursorPos = WINRT_TransformCursorPosition(window, sender->PointerPosition, TransformToSDLWindowSize); SDL_SendMouseMotion(window, 0, 0, (int)cursorPos.X, (int)cursorPos.Y); #endif @@ -628,7 +628,7 @@ void SDL_WinRTApp::OnSuspending(Platform::Object ^ sender, SuspendingEventArgs ^ // Let the Direct3D 11 renderer prepare for the app to be backgrounded. // This is necessary for Windows 8.1, possibly elsewhere in the future. // More details at: http://msdn.microsoft.com/en-us/library/windows/apps/Hh994929.aspx -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) if (WINRT_GlobalSDLWindow) { SDL_Renderer *renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow); if (renderer && (SDL_strcmp(renderer->info.name, "direct3d11") == 0)) { @@ -762,7 +762,7 @@ void SDL_WinRTApp::OnBackButtonPressed(Platform::Object ^ sender, Windows::UI::C { WINRT_OnBackButtonPressed(args); } -#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#elif SDL_WINAPI_FAMILY_PHONE void SDL_WinRTApp::OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args) { diff --git a/src/core/winrt/SDL_winrtapp_direct3d.h b/src/core/winrt/SDL_winrtapp_direct3d.h index 0208a6a4d..30867a69e 100644 --- a/src/core/winrt/SDL_winrtapp_direct3d.h +++ b/src/core/winrt/SDL_winrtapp_direct3d.h @@ -77,7 +77,7 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo #if NTDDI_VERSION >= NTDDI_WIN10 void OnBackButtonPressed(Platform::Object ^ sender, Windows::UI::Core::BackRequestedEventArgs ^ args); -#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#elif SDL_WINAPI_FAMILY_PHONE void OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args); #endif diff --git a/src/core/winrt/SDL_winrtapp_xaml.cpp b/src/core/winrt/SDL_winrtapp_xaml.cpp index 118f64bb6..808543d3f 100644 --- a/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -88,7 +88,7 @@ static void WINRT_OnRenderViaXAML(_In_ Platform::Object ^ sender, _In_ Platform: int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPanelAsIInspectable) { -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE return SDL_SetError("XAML support is not yet available in Windows Phone."); #else // Declare C++/CX namespaces: @@ -143,5 +143,5 @@ int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPane // All done, for now. return 0; -#endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP / else +#endif // SDL_WINAPI_FAMILY_PHONE / else } diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index c5f1eb4a6..cc442bf74 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -57,7 +57,7 @@ #elif defined(__FreeBSD__) && defined(__powerpc__) #include #include -#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP +#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) #include #include #endif @@ -123,7 +123,7 @@ #define CPU_CFG2_LSX (1 << 6) #define CPU_CFG2_LASX (1 << 7) -#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ && !__FreeBSD__ +#if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(__MACOSX__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) /* This is the brute force way of detecting instruction sets... the idea is borrowed from the libmpeg2 library - thanks! */ @@ -352,7 +352,7 @@ static int CPU_haveAltiVec(void) elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures)); altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC; return altivec; -#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP +#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) void (*handler)(int sig); handler = signal(SIGILL, illegal_instruction); if (setjmp(jmpbuf) == 0) { @@ -468,9 +468,9 @@ static int CPU_haveNEON(void) return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0; #elif (defined(__ARM_ARCH) && (__ARM_ARCH >= 8)) || defined(__aarch64__) return 1; /* ARMv8 always has non-optional NEON support. */ -#elif __VITA__ +#elif defined(__VITA__) return 1; -#elif __3DS__ +#elif defined(__3DS__) return 0; #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index 0cb6acf56..d0f91dd75 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -195,7 +195,7 @@ static SDL_DYNAPI_jump_table jump_table = { SDL_InitDynamicAPI(); \ ret jump_table.fn args; \ } -#define SDL_DYNAPI_PROC_NO_VARARGS 1 +#define SDL_DYNAPI_PROC_NO_VARARGS #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC_NO_VARARGS @@ -212,7 +212,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI()) { \ ret jump_table.fn args; \ } -#define SDL_DYNAPI_PROC_NO_VARARGS 1 +#define SDL_DYNAPI_PROC_NO_VARARGS #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC_NO_VARARGS @@ -295,7 +295,7 @@ SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Error, ERROR) SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Critical, CRITICAL) #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ rc SDLCALL fn##_LOGSDLCALLS params { SDL_Log_REAL("SDL2CALL %s", #fn); ret fn##_REAL args; } -#define SDL_DYNAPI_PROC_NO_VARARGS 1 +#define SDL_DYNAPI_PROC_NO_VARARGS #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC_NO_VARARGS @@ -505,7 +505,7 @@ static void SDL_InitDynamicAPI(void) /* SDL_AtomicLock calls SDL mutex functions to emulate if SDL_ATOMIC_DISABLED, which we can't do here, so in such a configuration, you're on your own. */ - #if !SDL_ATOMIC_DISABLED + #ifndef SDL_ATOMIC_DISABLED static SDL_SpinLock lock = 0; SDL_AtomicLock_REAL(&lock); #endif @@ -515,7 +515,7 @@ static void SDL_InitDynamicAPI(void) already_initialized = SDL_TRUE; } - #if !SDL_ATOMIC_DISABLED + #ifndef SDL_ATOMIC_DISABLED SDL_AtomicUnlock_REAL(&lock); #endif } diff --git a/src/dynapi/SDL_dynapi.h b/src/dynapi/SDL_dynapi.h index 99ca08008..9e0aaebfe 100644 --- a/src/dynapi/SDL_dynapi.h +++ b/src/dynapi/SDL_dynapi.h @@ -53,7 +53,7 @@ #define SDL_DYNAMIC_API 0 #elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */ #define SDL_DYNAMIC_API 0 -#elif defined(__PS2__) && __PS2__ +#elif defined(__PS2__) #define SDL_DYNAMIC_API 0 #elif defined(__PSP__) && __PSP__ #define SDL_DYNAMIC_API 0 diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 9d5f05ba4..e39a747cc 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -30,7 +30,7 @@ */ /* direct jump magic can use these, the rest needs special code. */ -#if !SDL_DYNAPI_PROC_NO_VARARGS +#ifndef SDL_DYNAPI_PROC_NO_VARARGS SDL_DYNAPI_PROC(int,SDL_SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),return) SDL_DYNAPI_PROC(void,SDL_Log,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),) SDL_DYNAPI_PROC(void,SDL_LogVerbose,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) @@ -888,7 +888,7 @@ SDL_DYNAPI_PROC(void*,SDL_GetTextureUserData,(SDL_Texture *a),(a),return) SDL_DYNAPI_PROC(int,SDL_RenderGeometry,(SDL_Renderer *a, SDL_Texture *b, const SDL_Vertex *c, int d, const int *e, int f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(int,SDL_RenderGeometryRaw,(SDL_Renderer *a, SDL_Texture *b, const float *c, int d, const SDL_Color *e, int f, const float *g, int h, int i, const void *j, int k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return) SDL_DYNAPI_PROC(int,SDL_RenderSetVSync,(SDL_Renderer *a, int b),(a,b),return) -#if !SDL_DYNAPI_PROC_NO_VARARGS +#ifndef SDL_DYNAPI_PROC_NO_VARARGS SDL_DYNAPI_PROC(int,SDL_asprintf,(char **a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),return) #endif SDL_DYNAPI_PROC(int,SDL_vasprintf,(char **a, const char *b, va_list c),(a,b,c),return) diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 05c2bf830..2ae83ff7b 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -28,7 +28,7 @@ #include "SDL_events_c.h" #include "../SDL_hints_c.h" #include "../timer/SDL_timer_c.h" -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED #include "../joystick/SDL_joystick_c.h" #endif #include "../video/SDL_sysvideo.h" @@ -98,7 +98,7 @@ static struct SDL_SysWMEntry *wmmsg_free; } SDL_EventQ = { NULL, SDL_FALSE, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED static SDL_bool SDL_update_joysticks = SDL_TRUE; @@ -119,7 +119,7 @@ static void SDLCALL SDL_AutoUpdateJoysticksChanged(void *userdata, const char *n #endif /* !SDL_JOYSTICK_DISABLED */ -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED static SDL_bool SDL_update_sensors = SDL_TRUE; @@ -621,7 +621,7 @@ int SDL_StartEventLoop(void) */ /* Create the lock and set ourselves active */ -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED if (!SDL_EventQ.lock) { SDL_EventQ.lock = SDL_CreateMutex(); if (SDL_EventQ.lock == NULL) { @@ -922,14 +922,14 @@ static void SDL_PumpEventsInternal(SDL_bool push_sentinel) _this->PumpEvents(_this); } -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED /* Check for joystick state change */ if (SDL_update_joysticks) { SDL_JoystickUpdate(); } #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED /* Check for sensor state change */ if (SDL_update_sensors) { SDL_SensorUpdate(); @@ -968,12 +968,12 @@ static SDL_bool SDL_events_need_periodic_poll() { SDL_bool need_periodic_poll = SDL_FALSE; -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED need_periodic_poll = SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_update_joysticks; #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED need_periodic_poll = need_periodic_poll || (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors); #endif @@ -1053,14 +1053,14 @@ static SDL_bool SDL_events_need_polling() { SDL_bool need_polling = SDL_FALSE; -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED need_polling = SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_update_joysticks && (SDL_NumJoysticks() > 0); #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED need_polling = need_polling || (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && (SDL_NumSensors() > 0)); #endif @@ -1342,10 +1342,10 @@ Uint8 SDL_EventState(Uint32 type, int state) SDL_disabled_events[hi]->bits[lo / 32] &= ~(1 << (lo & 31)); } -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED SDL_CalculateShouldUpdateJoysticks(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_TRUE)); #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED SDL_CalculateShouldUpdateSensors(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_TRUE)); #endif } @@ -1413,10 +1413,10 @@ int SDL_SendLocaleChangedEvent(void) int SDL_EventsInit(void) { -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL); #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL); #endif SDL_AddHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); @@ -1437,10 +1437,10 @@ void SDL_EventsQuit(void) SDL_StopEventLoop(); SDL_DelHintCallback(SDL_HINT_POLL_SENTINEL, SDL_PollSentinelChanged, NULL); SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL); #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL); #endif } diff --git a/src/events/SDL_keysym_to_scancode.c b/src/events/SDL_keysym_to_scancode.c index df0b6b12f..2e96b7c47 100644 --- a/src/events/SDL_keysym_to_scancode.c +++ b/src/events/SDL_keysym_to_scancode.c @@ -21,7 +21,7 @@ #include "../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 +#if defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_X11) #include "SDL_keyboard_c.h" #include "SDL_scancode_tables_c.h" diff --git a/src/events/SDL_quit.c b/src/events/SDL_quit.c index dba801a68..c5dee803d 100644 --- a/src/events/SDL_quit.c +++ b/src/events/SDL_quit.c @@ -85,7 +85,7 @@ static void SDL_EventSignal_Init(const int sig) action.sa_handler = SDL_HandleSIG; sigaction(sig, &action, NULL); } -#elif HAVE_SIGNAL_H +#elif defined(HAVE_SIGNAL_H) void (*ohandler)(int) = signal(sig, SDL_HandleSIG); if (ohandler != SIG_DFL) { signal(sig, ohandler); @@ -102,7 +102,7 @@ static void SDL_EventSignal_Quit(const int sig) action.sa_handler = SIG_DFL; sigaction(sig, &action, NULL); } -#elif HAVE_SIGNAL_H +#elif defined(HAVE_SIGNAL_H) void (*ohandler)(int) = signal(sig, SIG_DFL); if (ohandler != SDL_HandleSIG) { signal(sig, ohandler); diff --git a/src/events/SDL_scancode_tables.c b/src/events/SDL_scancode_tables.c index 359feb1e6..6f2b53c5c 100644 --- a/src/events/SDL_scancode_tables.c +++ b/src/events/SDL_scancode_tables.c @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if SDL_INPUT_LINUXEV || SDL_VIDEO_DRIVER_DIRECTFB || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 +#if defined(SDL_INPUT_LINUXEV) || defined(SDL_VIDEO_DRIVER_DIRECTFB) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_X11) #include "SDL_scancode_tables_c.h" diff --git a/src/events/default_cursor.h b/src/events/default_cursor.h index e8758f15a..b6288f8a3 100644 --- a/src/events/default_cursor.h +++ b/src/events/default_cursor.h @@ -27,7 +27,7 @@ #define DEFAULT_CHOTX 0 #define DEFAULT_CHOTY 0 -/* Added a real MacOS cursor, at the request of Luc-Olivier de Charrire */ +/* Added a real MacOS cursor, at the request of Luc-Olivier de Charrière */ #define USE_MACOS_CURSOR #ifdef USE_MACOS_CURSOR diff --git a/src/events/imKStoUCS.c b/src/events/imKStoUCS.c index 4aa85d423..d851dc1b6 100644 --- a/src/events/imKStoUCS.c +++ b/src/events/imKStoUCS.c @@ -26,7 +26,7 @@ DEALINGS IN THE SOFTWARE. #include "../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND +#if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) #include "imKStoUCS.h" static unsigned short const keysym_to_unicode_1a1_1ff[] = { diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index ac345a93d..0ebaf897d 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -62,7 +62,7 @@ #include "SDL_system.h" #endif -#if __NACL__ +#ifdef __NACL__ #include "nacl_io/nacl_io.h" #endif @@ -590,14 +590,14 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode) rwops->write = windows_file_write; rwops->close = windows_file_close; rwops->type = SDL_RWOPS_WINFILE; -#elif HAVE_STDIO_H +#elif defined(HAVE_STDIO_H) { -#if __APPLE__ && !SDL_FILE_DISABLED // TODO: add dummy? +#if defined(__APPLE__) && !defined(SDL_FILE_DISABLED) // TODO: add dummy? FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode); -#elif __WINRT__ +#elif defined(__WINRT__) FILE *fp = NULL; fopen_s(&fp, file, mode); -#elif __3DS__ +#elif defined(__3DS__) FILE *fp = N3DS_FileOpen(file, mode); #else FILE *fp = fopen(file, mode); diff --git a/src/filesystem/winrt/SDL_sysfilesystem.cpp b/src/filesystem/winrt/SDL_sysfilesystem.cpp index 9fa6dc57d..09bfbac4d 100644 --- a/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/src/filesystem/winrt/SDL_sysfilesystem.cpp @@ -71,7 +71,7 @@ SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType) return path.c_str(); } -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8) +#if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION > NTDDI_WIN8) case SDL_WINRT_PATH_ROAMING_FOLDER: { static wstring path; diff --git a/src/haptic/SDL_haptic.c b/src/haptic/SDL_haptic.c index 84472c040..b37141301 100644 --- a/src/haptic/SDL_haptic.c +++ b/src/haptic/SDL_haptic.c @@ -25,7 +25,7 @@ #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */ /* Global for SDL_windowshaptic.c */ -#if (defined(SDL_HAPTIC_DINPUT) && SDL_HAPTIC_DINPUT) || (defined(SDL_HAPTIC_XINPUT) && SDL_HAPTIC_XINPUT) +#if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT) SDL_Haptic *SDL_haptics = NULL; #else static SDL_Haptic *SDL_haptics = NULL; diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c index c10af57e9..984d99435 100644 --- a/src/haptic/linux/SDL_syshaptic.c +++ b/src/haptic/linux/SDL_syshaptic.c @@ -46,7 +46,7 @@ #define MAX_HAPTICS 32 /* It's doubtful someone has more then 32 evdev */ static int MaybeAddDevice(const char *path); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ @@ -164,7 +164,7 @@ int SDL_SYS_HapticInit(void) MaybeAddDevice(path); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (SDL_UDEV_Init() < 0) { return SDL_SetError("Could not initialize UDEV"); } @@ -203,7 +203,7 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index) return item; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (!devpath || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { @@ -293,7 +293,7 @@ static int MaybeAddDevice(const char *path) return numhaptics; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path) { SDL_hapticlist_item *item; @@ -608,7 +608,7 @@ void SDL_SYS_HapticQuit(void) SDL_free(item); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_DelCallback(haptic_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ diff --git a/src/haptic/windows/SDL_dinputhaptic.c b/src/haptic/windows/SDL_dinputhaptic.c index 68cd110eb..614e18dc9 100644 --- a/src/haptic/windows/SDL_dinputhaptic.c +++ b/src/haptic/windows/SDL_dinputhaptic.c @@ -25,7 +25,7 @@ #include "SDL_haptic.h" #include "../SDL_syshaptic.h" -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT #include "SDL_hints.h" #include "SDL_stdinc.h" diff --git a/src/haptic/windows/SDL_windowshaptic.c b/src/haptic/windows/SDL_windowshaptic.c index 530eb91da..c521a0d4f 100644 --- a/src/haptic/windows/SDL_windowshaptic.c +++ b/src/haptic/windows/SDL_windowshaptic.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT +#if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT) #include "SDL_thread.h" #include "SDL_mutex.h" @@ -160,7 +160,7 @@ int SDL_SYS_HapticOpen(SDL_Haptic *haptic) */ int SDL_SYS_HapticMouse(void) { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT SDL_hapticlist_item *item; int index = 0; @@ -183,12 +183,12 @@ int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick) if (joystick->driver != &SDL_WINDOWS_JoystickDriver) { return 0; } -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT if (joystick->hwdata->bXInputHaptic) { return 1; } #endif -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { return 1; } diff --git a/src/haptic/windows/SDL_windowshaptic_c.h b/src/haptic/windows/SDL_windowshaptic_c.h index 9ed62dd42..dbe18af70 100644 --- a/src/haptic/windows/SDL_windowshaptic_c.h +++ b/src/haptic/windows/SDL_windowshaptic_c.h @@ -38,7 +38,7 @@ extern "C" { */ struct haptic_hwdata { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT LPDIRECTINPUTDEVICE8 device; #endif DWORD axes[3]; /* Axes to use. */ @@ -54,14 +54,14 @@ struct haptic_hwdata /* * Haptic system effect data. */ -#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT +#if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT) struct haptic_hweffect { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT DIEFFECT effect; LPDIRECTINPUTEFFECT ref; #endif -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT XINPUT_VIBRATION vibration; #endif }; @@ -74,7 +74,7 @@ typedef struct SDL_hapticlist_item { char *name; SDL_Haptic *haptic; -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT DIDEVICEINSTANCE instance; DIDEVCAPS capabilities; #endif diff --git a/src/haptic/windows/SDL_xinputhaptic.c b/src/haptic/windows/SDL_xinputhaptic.c index 0eaf356bb..f387ead19 100644 --- a/src/haptic/windows/SDL_xinputhaptic.c +++ b/src/haptic/windows/SDL_xinputhaptic.c @@ -25,7 +25,7 @@ #include "SDL_haptic.h" #include "../SDL_syshaptic.h" -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT #include "SDL_hints.h" #include "SDL_timer.h" diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c index 0a6bd0754..26b80fe76 100644 --- a/src/hidapi/SDL_hidapi.c +++ b/src/hidapi/SDL_hidapi.c @@ -35,7 +35,7 @@ #include "SDL_thread.h" #include "SDL_timer.h" -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED #if defined(__WIN32__) || defined(__WINGDK__) #include "../core/windows/SDL_windows.h" @@ -556,9 +556,9 @@ static void HIDAPI_ShutdownDiscovery() #define read_thread PLATFORM_read_thread #undef HIDAPI_H__ -#if __LINUX__ +#ifdef __LINUX__ -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static const SDL_UDEV_Symbols *udev_ctx = NULL; #define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value @@ -578,23 +578,23 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL; #define udev_enumerate_unref udev_ctx->udev_enumerate_unref #include "linux/hid.c" -#define HAVE_PLATFORM_BACKEND 1 +#define HAVE_PLATFORM_BACKEND #endif /* SDL_USE_LIBUDEV */ -#elif __MACOSX__ +#elif defined(__MACOSX__) #include "mac/hid.c" -#define HAVE_PLATFORM_BACKEND 1 +#define HAVE_PLATFORM_BACKEND #define udev_ctx 1 -#elif __WINDOWS__ || __WINGDK__ +#elif defined(__WINDOWS__) || defined(__WINGDK__) #include "windows/hid.c" -#define HAVE_PLATFORM_BACKEND 1 +#define HAVE_PLATFORM_BACKEND #define udev_ctx 1 -#elif __ANDROID__ +#elif defined(__ANDROID__) /* The implementation for Android is in a separate .cpp file */ #include "hidapi/hidapi.h" #define HAVE_PLATFORM_BACKEND 1 #define udev_ctx 1 -#elif __IPHONEOS__ || __TVOS__ +#elif defined(__IPHONEOS__) || defined(__TVOS__) /* The implementation for iOS and tvOS is in a separate .m file */ #include "hidapi/hidapi.h" #define HAVE_PLATFORM_BACKEND 1 @@ -630,9 +630,11 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL; #ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX #define HAVE_DRIVER_BACKEND 1 +#else +#define HAVE_DRIVER_BACKEND 0 #endif -#ifdef HAVE_DRIVER_BACKEND +#if HAVE_DRIVER_BACKEND /* DRIVER HIDAPI Implementation */ @@ -897,7 +899,7 @@ struct hidapi_backend const wchar_t *(*hid_error)(void *device); }; -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND static const struct hidapi_backend PLATFORM_Backend = { (void *)PLATFORM_hid_write, (void *)PLATFORM_hid_read_timeout, @@ -956,7 +958,7 @@ struct SDL_hid_device_ }; static char device_magic; -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) static SDL_hid_device *CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend) { @@ -981,8 +983,8 @@ static void DeleteHIDDeviceWrapper(SDL_hid_device *device) return retval; \ } -#if !SDL_HIDAPI_DISABLED -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#ifndef SDL_HIDAPI_DISABLED +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) #define COPY_IF_EXISTS(var) \ if (pSrc->var != NULL) { \ @@ -1129,9 +1131,9 @@ int SDL_hid_init(void) } #endif /* HAVE_LIBUSB */ -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND ++attempts; -#if __LINUX__ +#ifdef __LINUX__ udev_ctx = SDL_UDEV_GetUdevSyms(); #endif /* __LINUX __ */ if (udev_ctx && PLATFORM_hid_init() == 0) { @@ -1160,15 +1162,15 @@ int SDL_hid_exit(void) } SDL_hidapi_refcount = 0; -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED HIDAPI_ShutdownDiscovery(); #endif -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { result |= PLATFORM_hid_exit(); } -#if __LINUX__ +#ifdef __LINUX__ SDL_UDEV_ReleaseUdevSyms(); #endif /* __LINUX __ */ #endif /* HAVE_PLATFORM_BACKEND */ @@ -1190,7 +1192,7 @@ Uint32 SDL_hid_device_change_count(void) { Uint32 counter = 0; -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return 0; } @@ -1210,7 +1212,7 @@ Uint32 SDL_hid_device_change_count(void) struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id) { -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) #ifdef HAVE_LIBUSB struct SDL_hid_device_info *usb_devs = NULL; struct SDL_hid_device_info *usb_dev; @@ -1219,7 +1221,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned struct SDL_hid_device_info *driver_devs = NULL; struct SDL_hid_device_info *driver_dev; #endif -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND struct SDL_hid_device_info *raw_devs = NULL; struct SDL_hid_device_info *raw_dev; #endif @@ -1260,7 +1262,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned } #endif /* HAVE_LIBUSB */ -#ifdef HAVE_DRIVER_BACKEND +#if HAVE_DRIVER_BACKEND driver_devs = DRIVER_hid_enumerate(vendor_id, product_id); for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) { new_dev = (struct SDL_hid_device_info *)SDL_malloc(sizeof(struct SDL_hid_device_info)); @@ -1275,7 +1277,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned } #endif /* HAVE_DRIVER_BACKEND */ -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id); #ifdef DEBUG_HIDAPI @@ -1298,7 +1300,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned } } #endif -#ifdef HAVE_DRIVER_BACKEND +#if HAVE_DRIVER_BACKEND for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) { if (raw_dev->vendor_id == driver_dev->vendor_id && raw_dev->product_id == driver_dev->product_id && @@ -1363,14 +1365,14 @@ void SDL_hid_free_enumeration(struct SDL_hid_device_info *devs) SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) { -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) void *pDevice = NULL; if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return NULL; } -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number); if (pDevice != NULL) { @@ -1402,14 +1404,14 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */) { -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) void *pDevice = NULL; if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return NULL; } -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { pDevice = PLATFORM_hid_open_path(path, bExclusive); if (pDevice != NULL) { @@ -1579,7 +1581,7 @@ int SDL_hid_get_indexed_string(SDL_hid_device *device, int string_index, wchar_t void SDL_hid_ble_scan(SDL_bool active) { -#if !SDL_HIDAPI_DISABLED && (__IPHONEOS__ || __TVOS__) +#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IPHONEOS__) || defined(__TVOS__)) hid_ble_scan(active); #endif } diff --git a/src/hidapi/android/hid.cpp b/src/hidapi/android/hid.cpp index 34fda42d3..3b050a672 100644 --- a/src/hidapi/android/hid.cpp +++ b/src/hidapi/android/hid.cpp @@ -48,7 +48,7 @@ #define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function) -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED #include "SDL_hints.h" #include "../../core/android/SDL_android.h" @@ -744,7 +744,7 @@ public: env->CallVoidMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerClose, m_nId ); ExceptionCheck( env, "Close" ); } - + hid_mutex_guard dataLock( &m_dataLock ); m_vecData.clear(); @@ -1139,7 +1139,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx hid_mutex_guard l( &g_DevicesMutex ); for ( hid_device_ref pCurr = g_Devices; pCurr; pCurr = pCurr->next ) { - if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 ) + if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 ) { hid_device *pValue = pCurr->GetDevice(); if ( pValue ) diff --git a/src/hidapi/hidapi/hidapi.h b/src/hidapi/hidapi/hidapi.h index 3fddfa885..1114aefc9 100644 --- a/src/hidapi/hidapi/hidapi.h +++ b/src/hidapi/hidapi/hidapi.h @@ -406,7 +406,7 @@ namespace NAMESPACE { */ HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev); -#if __IPHONEOS__ || __TVOS__ +#if defined(__IPHONEOS__) || defined(__TVOS__) HID_API_EXPORT void HID_API_CALL hid_ble_scan(int active); #endif diff --git a/src/hidapi/ios/hid.m b/src/hidapi/ios/hid.m index 8ebfdbe72..730e10b81 100644 --- a/src/hidapi/ios/hid.m +++ b/src/hidapi/ios/hid.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED #include "SDL_hints.h" @@ -131,7 +131,7 @@ static void RingBuffer_init( RingBuffer *this ) this->_last = 0; pthread_mutex_init( &this->accessLock, 0 ); } - + static bool RingBuffer_write( RingBuffer *this, const uint8_t *src ) { pthread_mutex_lock( &this->accessLock ); @@ -290,7 +290,7 @@ typedef enum { static uint64_t s_unLastUpdateTick = 0; static mach_timebase_info_data_t s_timebase_info; - + if ( self.centralManager == nil ) { return 0; @@ -300,11 +300,11 @@ typedef enum { mach_timebase_info( &s_timebase_info ); } - + uint64_t ticksNow = mach_approximate_time(); if ( !bForce && ( ( (ticksNow - s_unLastUpdateTick) * s_timebase_info.numer ) / s_timebase_info.denom ) < (5ull * NSEC_PER_SEC) ) return (int)self.deviceMap.count; - + // we can see previously connected BLE peripherals but can't connect until the CBCentralManager // is fully powered up - only do work when we are in that state if ( self.centralManager.state != CBManagerStatePoweredOn ) @@ -312,7 +312,7 @@ typedef enum // only update our last-check-time if we actually did work, otherwise there can be a long delay during initial power-up s_unLastUpdateTick = mach_approximate_time(); - + // if a pair is in-flight, the central manager may still give it back via retrieveConnected... and // cause the SDL layer to attempt to initialize it while some of its endpoints haven't yet been established if ( self.nPendingPairs > 0 ) @@ -324,7 +324,7 @@ typedef enum // we already know this peripheral if ( [self.deviceMap objectForKey: peripheral] != nil ) continue; - + NSLog( @"connected peripheral: %@", peripheral ); if ( [peripheral.name isEqualToString:@"SteamController"] ) { @@ -392,7 +392,7 @@ typedef enum case CBCentralManagerStatePoweredOn: { NSLog( @"CoreBluetooth BLE hardware is powered on and ready" ); - + // at startup, if we have no already attached peripherals, do a 20s scan for new unpaired devices, // otherwise callers should occaisionally do additional scans. we don't want to continuously be // scanning because it drains battery, causes other nearby people to have a hard time pairing their @@ -408,23 +408,23 @@ typedef enum } break; } - + case CBCentralManagerStatePoweredOff: NSLog( @"CoreBluetooth BLE hardware is powered off" ); break; - + case CBCentralManagerStateUnauthorized: NSLog( @"CoreBluetooth BLE state is unauthorized" ); break; - + case CBCentralManagerStateUnknown: NSLog( @"CoreBluetooth BLE state is unknown" ); break; - + case CBCentralManagerStateUnsupported: NSLog( @"CoreBluetooth BLE hardware is unsupported on this platform" ); break; - + case CBCentralManagerStateResetting: NSLog( @"CoreBluetooth BLE manager is resetting" ); break; @@ -449,7 +449,7 @@ typedef enum { NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey]; NSString *log = [NSString stringWithFormat:@"Found '%@'", localName]; - + if ( [localName isEqualToString:@"SteamController"] ) { NSLog( @"%@ : %@ - %@", log, peripheral, advertisementData ); @@ -552,7 +552,7 @@ static void process_pending_events() { #if FEATURE_REPORT_LOGGING uint8_t *reportBytes = (uint8_t *)report; - + NSLog( @"HIDBLE:send_feature_report (%02zu/19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", GetBluetoothSegmentSize( report->segment ), reportBytes[1], reportBytes[2], reportBytes[3], reportBytes[4], reportBytes[5], reportBytes[6], reportBytes[7], reportBytes[8], reportBytes[9], reportBytes[10], reportBytes[11], reportBytes[12], @@ -568,7 +568,7 @@ static void process_pending_events() // fire-and-forget - we are going to not wait for the response here because all Steam Controller BLE send_feature_report's are ignored, // except errors. [_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse]; - + // pretend we received a result anybody cares about return 19; @@ -578,18 +578,18 @@ static void process_pending_events() _waitStateForWriteFeatureReport = BLEDeviceWaitState_Waiting; [_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize ] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse]; - + while ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Waiting ) { process_pending_events(); } - + if ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Error ) { _waitStateForWriteFeatureReport = BLEDeviceWaitState_None; return -1; } - + _waitStateForWriteFeatureReport = BLEDeviceWaitState_None; return 19; #endif @@ -599,20 +599,20 @@ static void process_pending_events() { _waitStateForReadFeatureReport = BLEDeviceWaitState_Waiting; [_bleSteamController readValueForCharacteristic:_bleCharacteristicReport]; - + while ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Waiting ) process_pending_events(); - + if ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Error ) { _waitStateForReadFeatureReport = BLEDeviceWaitState_None; return -1; } - + memcpy( buffer, _featureReport, sizeof(_featureReport) ); - + _waitStateForReadFeatureReport = BLEDeviceWaitState_None; - + #if FEATURE_REPORT_LOGGING NSLog( @"HIDBLE:get_feature_report (19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], @@ -657,7 +657,7 @@ static void process_pending_events() for (CBCharacteristic *aChar in service.characteristics) { NSLog( @"Found Characteristic %@", aChar ); - + if ( [aChar.UUID isEqual:[CBUUID UUIDWithString:VALVE_INPUT_CHAR]] ) { self.bleCharacteristicInput = aChar; @@ -704,7 +704,7 @@ static void process_pending_events() else if ( [characteristic.UUID isEqual:_bleCharacteristicReport.UUID] ) { memset( _featureReport, 0, sizeof(_featureReport) ); - + if ( error != nil ) { NSLog( @"HIDBLE: get_feature_report error: %@", error ); @@ -789,13 +789,13 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path( const char *path, int bE NSString *nssPath = [NSString stringWithUTF8String:path]; HIDBLEManager *bleManager = HIDBLEManager.sharedInstance; NSEnumerator *devices = [bleManager.deviceMap objectEnumerator]; - + for ( HIDBLEDevice *device in devices ) { // we have the device but it hasn't found its service or characteristics until it is connected if ( !device.ready || !device.connected || !device.bleCharacteristicInput ) continue; - + if ( [device.bleSteamController.identifier.UUIDString isEqualToString:nssPath] ) { result = (hid_device *)malloc( sizeof( hid_device ) ); @@ -829,7 +829,7 @@ int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock) { /* All Nonblocking operation is handled by the library. */ dev->blocking = !nonblock; - + return 0; } @@ -953,7 +953,7 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, return -1; size_t written = [device_handle get_feature_report:data[0] into:data]; - + return written == length-1 ? (int)length : (int)written; } @@ -973,7 +973,7 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t if ( !device_handle.connected ) return -1; - + if ( milliseconds != 0 ) { NSLog( @"hid_read_timeout with non-zero wait" ); diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index cc1dc06a1..943be08ac 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -32,7 +32,7 @@ #include "usb_ids.h" #include "hidapi/SDL_hidapi_nintendo.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif @@ -828,7 +828,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG } } -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT if (SDL_IsJoystickXInput(guid)) { /* This is an XInput device */ return s_pXInputMapping; @@ -1152,7 +1152,7 @@ static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); SDL_memcpy(&pchGUID[0], "03000000", 8); } -#elif __MACOSX__ +#elif defined(__MACOSX__) if (SDL_strlen(pchGUID) == 32 && SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 && SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) { @@ -3061,7 +3061,7 @@ static int SDL_PrivateGameControllerAxis(SDL_GameController *gamecontroller, SDL /* translate the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_CONTROLLERAXISMOTION) == SDL_ENABLE) { SDL_Event event; event.type = SDL_CONTROLLERAXISMOTION; @@ -3080,7 +3080,7 @@ static int SDL_PrivateGameControllerAxis(SDL_GameController *gamecontroller, SDL static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button, Uint8 state) { int posted; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; SDL_AssertJoysticksLocked(); @@ -3122,7 +3122,7 @@ static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, S /* translate the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(event.type) == SDL_ENABLE) { event.cbutton.which = gamecontroller->joystick->instance_id; event.cbutton.button = button; @@ -3138,7 +3138,7 @@ static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, S */ int SDL_GameControllerEventState(int state) { -#if SDL_EVENTS_DISABLED +#ifdef SDL_EVENTS_DISABLED return SDL_IGNORE; #else const Uint32 event_list[] = { diff --git a/src/joystick/SDL_gamecontrollerdb.h b/src/joystick/SDL_gamecontrollerdb.h index 92927877a..8611e5597 100644 --- a/src/joystick/SDL_gamecontrollerdb.h +++ b/src/joystick/SDL_gamecontrollerdb.h @@ -29,10 +29,10 @@ Alternatively, you can use the app located in test/controllermap */ static const char *s_ControllerMappings[] = { -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", #endif -#if SDL_JOYSTICK_WGI +#ifdef SDL_JOYSTICK_WGI "03000000491900001904000000007700,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,", "03000000d11800000094000000007700,Google Stadia Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,misc1:b12,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "030000007e0500000920000000007701,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -42,7 +42,7 @@ static const char *s_ControllerMappings[] = { "0300000032150000000a000000007703,Razer Atrox Arcade Stick,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,lefttrigger:b8,rightshoulder:b5,righttrigger:b9,x:b2,y:b3,", "03000000de280000ff11000000007701,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a4,leftx:a1,lefty:a0~,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a2~,start:b7,x:b2,y:b3,", #endif -#if SDL_JOYSTICK_DINPUT +#ifdef SDL_JOYSTICK_DINPUT "03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,", "03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -942,7 +942,7 @@ static const char *s_ControllerMappings[] = { "0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b1,b:b0,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", #endif -#if SDL_JOYSTICK_MFI +#ifdef SDL_JOYSTICK_MFI "05000000ac050000010000004f066d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,", "05000000ac05000001000000cf076d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,", "05000000ac05000001000000df076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", @@ -978,19 +978,19 @@ static const char *s_ControllerMappings[] = { "050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "050000005e040000e0020000ff070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,", #endif -#if SDL_JOYSTICK_EMSCRIPTEN +#ifdef SDL_JOYSTICK_EMSCRIPTEN "default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", #endif -#if SDL_JOYSTICK_PS2 +#ifdef SDL_JOYSTICK_PS2 "0000000050533220436f6e74726f6c00,PS2 Controller,crc:ed87,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", #endif -#if SDL_JOYSTICK_PSP +#ifdef SDL_JOYSTICK_PSP "00000000505350206275696c74696e00,PSP builtin joypad,crc:bb86,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif -#if SDL_JOYSTICK_VITA +#ifdef SDL_JOYSTICK_VITA "0000000050535669746120436f6e7400,PSVita Controller,crc:d598,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif -#if SDL_JOYSTICK_N3DS +#ifdef SDL_JOYSTICK_N3DS "000000004e696e74656e646f20334400,Nintendo 3DS,crc:3210,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b8,righttrigger:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", #endif "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index ceb51d020..5b8728278 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -29,7 +29,7 @@ #include "SDL_hints.h" #include "../SDL_hints_c.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif #include "../video/SDL_sysvideo.h" @@ -46,7 +46,7 @@ #include #endif -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL #include "./virtual/SDL_virtualjoystick_c.h" #endif @@ -319,7 +319,7 @@ int SDL_JoystickInit(void) SDL_joystick_lock = SDL_CreateMutex(); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { return -1; } @@ -606,7 +606,7 @@ int SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nbuttons, in int SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc) { -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL int retval; SDL_LockJoysticks(); @@ -620,7 +620,7 @@ int SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc) int SDL_JoystickDetachVirtual(int device_index) { -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL SDL_JoystickDriver *driver; SDL_LockJoysticks(); @@ -641,7 +641,7 @@ int SDL_JoystickDetachVirtual(int device_index) SDL_bool SDL_JoystickIsVirtual(int device_index) { -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL SDL_JoystickDriver *driver; int driver_device_index; SDL_bool is_virtual = SDL_FALSE; @@ -668,7 +668,7 @@ int SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value) { CHECK_JOYSTICK_MAGIC(joystick, -1); -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL retval = SDL_JoystickSetVirtualAxisInner(joystick, axis, value); #else retval = SDL_SetError("SDL not built with virtual-joystick support"); @@ -687,7 +687,7 @@ int SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value { CHECK_JOYSTICK_MAGIC(joystick, -1); -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL retval = SDL_JoystickSetVirtualButtonInner(joystick, button, value); #else retval = SDL_SetError("SDL not built with virtual-joystick support"); @@ -706,7 +706,7 @@ int SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value) { CHECK_JOYSTICK_MAGIC(joystick, -1); -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL retval = SDL_JoystickSetVirtualHatInner(joystick, hat, value); #else retval = SDL_SetError("SDL not built with virtual-joystick support"); @@ -1339,7 +1339,7 @@ void SDL_JoystickQuit(void) SDL_joystick_player_count = 0; } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif @@ -1443,7 +1443,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance) SDL_SetJoystickIDForPlayerIndex(player_index, device_instance); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED { SDL_Event event; @@ -1457,6 +1457,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance) #endif /* !SDL_EVENTS_DISABLED */ } +#ifndef SDL_EVENTS_DISABLED /* * If there is an existing add event in the queue, it needs to be modified * to have the right value for which, because the number of controllers in @@ -1516,6 +1517,7 @@ static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type) SDL_small_free(events, isstack); } +#endif void SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick) { @@ -1552,7 +1554,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance) SDL_Joystick *joystick = NULL; int player_index; int device_index; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; #endif @@ -1570,7 +1572,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance) ++device_index; } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_zero(event); event.type = SDL_JOYDEVICEREMOVED; @@ -1642,7 +1644,7 @@ int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value) /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) { SDL_Event event; event.type = SDL_JOYAXISMOTION; @@ -1683,7 +1685,7 @@ int SDL_PrivateJoystickHat(SDL_Joystick *joystick, Uint8 hat, Uint8 value) /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) { SDL_Event event; event.jhat.type = SDL_JOYHATMOTION; @@ -1718,7 +1720,7 @@ int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sin /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) { SDL_Event event; event.jball.type = SDL_JOYBALLMOTION; @@ -1735,7 +1737,7 @@ int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sin int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state) { int posted; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; SDL_AssertJoysticksLocked(); @@ -1776,7 +1778,7 @@ int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state) /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(event.type) == SDL_ENABLE) { event.jbutton.which = joystick->instance_id; event.jbutton.button = button; @@ -1847,7 +1849,7 @@ void SDL_JoystickUpdate(void) int SDL_JoystickEventState(int state) { -#if SDL_EVENTS_DISABLED +#ifdef SDL_EVENTS_DISABLED return SDL_DISABLE; #else const Uint32 event_list[] = { @@ -3040,7 +3042,7 @@ void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLe SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */ if (ePowerLevel != joystick->epowerlevel) { -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_JOYBATTERYUPDATED) == SDL_ENABLE) { SDL_Event event; event.type = SDL_JOYBATTERYUPDATED; @@ -3143,7 +3145,7 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(event_type) == SDL_ENABLE) { SDL_Event event; event.type = event_type; @@ -3183,7 +3185,7 @@ int SDL_PrivateJoystickSensor(SDL_Joystick *joystick, SDL_SensorType type, Uint6 sensor->timestamp_us = timestamp_us; /* Post the event, if desired */ -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_CONTROLLERSENSORUPDATE) == SDL_ENABLE) { SDL_Event event; event.type = SDL_CONTROLLERSENSORUPDATE; diff --git a/src/joystick/bsd/SDL_bsdjoystick.c b/src/joystick/bsd/SDL_bsdjoystick.c index bb3f54462..e30426314 100644 --- a/src/joystick/bsd/SDL_bsdjoystick.c +++ b/src/joystick/bsd/SDL_bsdjoystick.c @@ -782,7 +782,7 @@ static int report_alloc(struct report *r, struct report_desc *rd, int repind) #ifdef __DragonFly__ len = hid_report_size(rd, repinfo[repind].kind, r->rid); -#elif __FREEBSD__ +#elif defined(__FREEBSD__) #if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__) #if (__FreeBSD_kernel_version <= 500111) len = hid_report_size(rd, r->rid, repinfo[repind].kind); diff --git a/src/joystick/darwin/SDL_iokitjoystick.c b/src/joystick/darwin/SDL_iokitjoystick.c index e68adc720..5980ce6e9 100644 --- a/src/joystick/darwin/SDL_iokitjoystick.c +++ b/src/joystick/darwin/SDL_iokitjoystick.c @@ -237,7 +237,7 @@ static void JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *s device->ffdevice = NULL; device->ff_initialized = SDL_FALSE; } -#if SDL_HAPTIC_IOKIT +#ifdef SDL_HAPTIC_IOKIT MacHaptic_MaybeRemoveDevice(device->ffservice); #endif @@ -557,7 +557,7 @@ static void JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender ioservice = IOHIDDeviceGetService(ioHIDDeviceObject); if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) { device->ffservice = ioservice; -#if SDL_HAPTIC_IOKIT +#ifdef SDL_HAPTIC_IOKIT MacHaptic_MaybeAddDevice(ioservice); #endif } diff --git a/src/joystick/iphoneos/SDL_mfijoystick.m b/src/joystick/iphoneos/SDL_mfijoystick.m index 6befc282b..bf9be56de 100644 --- a/src/joystick/iphoneos/SDL_mfijoystick.m +++ b/src/joystick/iphoneos/SDL_mfijoystick.m @@ -33,7 +33,7 @@ #include "SDL_mfijoystick_c.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../../events/SDL_events_c.h" #endif @@ -60,6 +60,18 @@ static NSString *GCInputXboxShareButton = @"Button Share"; #include #include +#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED +#define __IPHONE_OS_VERSION_MAX_ALLOWED 0 +#endif + +#ifndef __APPLETV_OS_VERSION_MAX_ALLOWED +#define __APPLETV_OS_VERSION_MAX_ALLOWED 0 +#endif + +#ifndef __MAC_OS_VERSION_MAX_ALLOWED +#define __MAC_OS_VERSION_MAX_ALLOWED 0 +#endif + /* remove compilation warnings for strict builds by defining these selectors, even though * they are only ever used indirectly through objc_msgSend */ @@ -948,7 +960,7 @@ static Uint8 IOS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad) static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) { -#if SDL_JOYSTICK_MFI +#ifdef SDL_JOYSTICK_MFI @autoreleasepool { GCController *controller = joystick->hwdata->controller; Uint8 hatstate = SDL_HAT_CENTERED; diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 94621ddc9..9e8a181aa 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -263,7 +263,7 @@ static int IsJoystick(const char *path, int fd, char **name_return, SDL_Joystick if (ioctl(fd, JSIOCGNAME(sizeof(product_string)), product_string) >= 0) { SDL_zero(inpid); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version); #endif } else { @@ -328,7 +328,7 @@ static int IsSensor(const char *path, int fd) return GuessIsSensor(fd); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (!devpath) { @@ -863,7 +863,7 @@ static void LINUX_FallbackJoystickDetect(void) static void LINUX_JoystickDetect(void) { -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_LIBUDEV) { SDL_UDEV_Poll(); } else @@ -916,7 +916,7 @@ static int LINUX_JoystickInit(void) /* Manually scan first, since we sort by device number and udev doesn't */ LINUX_JoystickDetect(); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_UNSET) { if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, @@ -2141,7 +2141,7 @@ static void LINUX_JoystickQuit(void) numjoysticks = 0; -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_LIBUDEV) { SDL_UDEV_DelCallback(joystick_udev_callback); SDL_UDEV_Quit(); diff --git a/src/joystick/ps2/SDL_sysjoystick.c b/src/joystick/ps2/SDL_sysjoystick.c index 698d632bf..a623233cd 100644 --- a/src/joystick/ps2/SDL_sysjoystick.c +++ b/src/joystick/ps2/SDL_sysjoystick.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_PS2 +#ifdef SDL_JOYSTICK_PS2 /* This is the PS2 implementation of the SDL joystick API */ #include diff --git a/src/joystick/psp/SDL_sysjoystick.c b/src/joystick/psp/SDL_sysjoystick.c index 3478ca803..edf289763 100644 --- a/src/joystick/psp/SDL_sysjoystick.c +++ b/src/joystick/psp/SDL_sysjoystick.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_PSP +#ifdef SDL_JOYSTICK_PSP /* This is the PSP implementation of the SDL joystick API */ #include diff --git a/src/joystick/virtual/SDL_virtualjoystick.c b/src/joystick/virtual/SDL_virtualjoystick.c index 8706bb3d3..ced1b6298 100644 --- a/src/joystick/virtual/SDL_virtualjoystick.c +++ b/src/joystick/virtual/SDL_virtualjoystick.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_JOYSTICK_VIRTUAL) +#ifdef SDL_JOYSTICK_VIRTUAL /* This is the virtual implementation of the SDL joystick API */ diff --git a/src/joystick/virtual/SDL_virtualjoystick_c.h b/src/joystick/virtual/SDL_virtualjoystick_c.h index 9fa0594d6..c027abb48 100644 --- a/src/joystick/virtual/SDL_virtualjoystick_c.h +++ b/src/joystick/virtual/SDL_virtualjoystick_c.h @@ -23,7 +23,7 @@ #ifndef SDL_VIRTUALJOYSTICK_C_H #define SDL_VIRTUALJOYSTICK_C_H -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL #include "SDL_joystick.h" diff --git a/src/joystick/vita/SDL_sysjoystick.c b/src/joystick/vita/SDL_sysjoystick.c index ce66c7cbc..d72407b7b 100644 --- a/src/joystick/vita/SDL_sysjoystick.c +++ b/src/joystick/vita/SDL_sysjoystick.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_VITA +#ifdef SDL_JOYSTICK_VITA /* This is the PSVita implementation of the SDL joystick API */ #include diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c index 21ef46c3e..c614caf31 100644 --- a/src/joystick/windows/SDL_dinputjoystick.c +++ b/src/joystick/windows/SDL_dinputjoystick.c @@ -22,7 +22,7 @@ #include "../SDL_sysjoystick.h" -#if SDL_JOYSTICK_DINPUT +#ifdef SDL_JOYSTICK_DINPUT #include "SDL_hints.h" #include "SDL_timer.h" diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 03bcdb78a..f0003681e 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -31,7 +31,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT #include "SDL_atomic.h" #include "SDL_endian.h" diff --git a/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c index f49bc61ac..e9232ba24 100644 --- a/src/joystick/windows/SDL_windowsjoystick.c +++ b/src/joystick/windows/SDL_windowsjoystick.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT) /* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de * A. Formiga's WINMM driver. @@ -252,7 +252,7 @@ static LRESULT CALLBACK SDL_PrivateJoystickDetectProc(HWND hwnd, UINT msg, WPARA break; } -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT return CallWindowProc(RAWINPUT_WindowProc, hwnd, msg, wParam, lParam); #else return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); @@ -261,7 +261,7 @@ static LRESULT CALLBACK SDL_PrivateJoystickDetectProc(HWND hwnd, UINT msg, WPARA static void SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data) { -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT RAWINPUT_UnregisterNotifications(); #endif @@ -318,7 +318,7 @@ static int SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data) return -1; } -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT RAWINPUT_RegisterNotifications(data->messageWindow); #endif return 0; @@ -356,7 +356,7 @@ static SDL_DeviceNotificationData s_notification_data; /* Function/thread to scan the system for joysticks. */ static int SDLCALL SDL_JoystickThread(void *_data) { -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT]; SDL_zeroa(bOpenedXInputDevices); #endif @@ -374,7 +374,7 @@ static int SDLCALL SDL_JoystickThread(void *_data) #else { #endif -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */ SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000); if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) { @@ -558,11 +558,11 @@ void WINDOWS_JoystickDetect(void) JoyStick_DeviceData *pListNext = NULL; if (pCurList->bXInputDevice) { -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT SDL_XINPUT_HapticMaybeRemoveDevice(pCurList->XInputUserId); #endif } else { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT SDL_DINPUT_HapticMaybeRemoveDevice(&pCurList->dxdevice); #endif } @@ -578,11 +578,11 @@ void WINDOWS_JoystickDetect(void) for (pCurList = SYS_Joystick; pCurList; pCurList = pCurList->pNext) { if (pCurList->send_add_event) { if (pCurList->bXInputDevice) { -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT SDL_XINPUT_HapticMaybeAddDevice(pCurList->XInputUserId); #endif } else { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT SDL_DINPUT_HapticMaybeAddDevice(&pCurList->dxdevice); #endif } @@ -824,9 +824,9 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver = { #else -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT /* The RAWINPUT driver needs the device notification setup above */ -#error SDL_JOYSTICK_RAWINPUT requires SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT +#error SDL_JOYSTICK_RAWINPUT requires SDL_JOYSTICK_DINPUT || defined(SDL_JOYSTICK_XINPUT) #endif #endif /* SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT */ diff --git a/src/joystick/windows/SDL_windowsjoystick_c.h b/src/joystick/windows/SDL_windowsjoystick_c.h index 8c601a421..8f5270977 100644 --- a/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/src/joystick/windows/SDL_windowsjoystick_c.h @@ -72,7 +72,7 @@ struct joystick_hwdata { SDL_JoystickGUID guid; -#if SDL_JOYSTICK_DINPUT +#ifdef SDL_JOYSTICK_DINPUT LPDIRECTINPUTDEVICE8 InputDevice; DIDEVCAPS Capabilities; SDL_bool buffered; @@ -90,7 +90,7 @@ struct joystick_hwdata DWORD dwPacketNumber; }; -#if SDL_JOYSTICK_DINPUT +#ifdef SDL_JOYSTICK_DINPUT extern const DIDATAFORMAT SDL_c_dfDIJoystick2; #endif diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c index 48cbdb021..4da276f06 100644 --- a/src/joystick/windows/SDL_xinputjoystick.c +++ b/src/joystick/windows/SDL_xinputjoystick.c @@ -22,7 +22,7 @@ #include "../SDL_sysjoystick.h" -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT #include "SDL_hints.h" #include "SDL_timer.h" diff --git a/src/loadso/dlopen/SDL_sysloadso.c b/src/loadso/dlopen/SDL_sysloadso.c index c4babc4d3..912d3d154 100644 --- a/src/loadso/dlopen/SDL_sysloadso.c +++ b/src/loadso/dlopen/SDL_sysloadso.c @@ -30,7 +30,7 @@ #include "SDL_loadso.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "../../video/uikit/SDL_uikitvideo.h" #endif @@ -39,7 +39,7 @@ void *SDL_LoadObject(const char *sofile) void *handle; const char *loaderror; -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT if (!UIKit_IsSystemVersionAtLeast(8.0)) { SDL_SetError("SDL_LoadObject requires iOS 8+"); return NULL; diff --git a/src/locale/winrt/SDL_syslocale.c b/src/locale/winrt/SDL_syslocale.c index 3995f9a2b..83b379496 100644 --- a/src/locale/winrt/SDL_syslocale.c +++ b/src/locale/winrt/SDL_syslocale.c @@ -33,7 +33,7 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen) int ret = 0; /* !!! FIXME: do we not have GetUserPreferredUILanguages on WinPhone or UWP? */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE ret = GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_SNAME, wbuffer, SDL_arraysize(wbuffer)); #else ret = GetSystemDefaultLocaleName(wbuffer, SDL_arraysize(wbuffer)); diff --git a/src/main/haiku/SDL_BApp.h b/src/main/haiku/SDL_BApp.h index 036808167..867465f42 100644 --- a/src/main/haiku/SDL_BApp.h +++ b/src/main/haiku/SDL_BApp.h @@ -24,7 +24,7 @@ #include #include #include -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include #endif @@ -85,7 +85,7 @@ class SDL_BLooper : public BLooper public: SDL_BLooper(const char* name) : BLooper(name) { -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _current_context = NULL; #endif } @@ -199,7 +199,7 @@ class SDL_BLooper : public BLooper return _window_map[winID]; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *GetCurrentContext() { return _current_context; @@ -419,7 +419,7 @@ class SDL_BLooper : public BLooper /* Members */ std::vector _window_map; /* Keeps track of SDL_Windows by index-id */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *_current_context; #endif }; diff --git a/src/main/nacl/SDL_nacl_main.c b/src/main/nacl/SDL_nacl_main.c index 10d94e227..85c5cebd3 100644 --- a/src/main/nacl/SDL_nacl_main.c +++ b/src/main/nacl/SDL_nacl_main.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL /* Include the SDL main definition header */ #include "SDL_main.h" diff --git a/src/power/android/SDL_syspower.c b/src/power/android/SDL_syspower.c index 3dccdecda..37d64ee0c 100644 --- a/src/power/android/SDL_syspower.c +++ b/src/power/android/SDL_syspower.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_ANDROID +#ifdef SDL_POWER_ANDROID #include "SDL_power.h" #include "../SDL_syspower.h" diff --git a/src/power/emscripten/SDL_syspower.c b/src/power/emscripten/SDL_syspower.c index 6a1f3176c..a6a56e48d 100644 --- a/src/power/emscripten/SDL_syspower.c +++ b/src/power/emscripten/SDL_syspower.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_EMSCRIPTEN +#ifdef SDL_POWER_EMSCRIPTEN #include diff --git a/src/power/haiku/SDL_syspower.c b/src/power/haiku/SDL_syspower.c index 6e7dd928e..3413a582b 100644 --- a/src/power/haiku/SDL_syspower.c +++ b/src/power/haiku/SDL_syspower.c @@ -24,7 +24,7 @@ /* !!! FIXME: does this thing even work on Haiku? */ #ifndef SDL_POWER_DISABLED -#if SDL_POWER_HAIKU +#ifdef SDL_POWER_HAIKU #include #include diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c index 0e17c9dd2..ea7e72e34 100644 --- a/src/power/linux/SDL_syspower.c +++ b/src/power/linux/SDL_syspower.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_LINUX +#ifdef SDL_POWER_LINUX #include #include @@ -521,7 +521,7 @@ SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, in } /* d-bus queries to org.freedesktop.UPower. */ -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS #define UPOWER_DBUS_NODE "org.freedesktop.UPower" #define UPOWER_DBUS_PATH "/org/freedesktop/UPower" #define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" @@ -611,7 +611,7 @@ SDL_bool SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, in { SDL_bool retval = SDL_FALSE; -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBusContext *dbus = SDL_DBus_GetContext(); char **paths = NULL; int i, numpaths = 0; diff --git a/src/power/macosx/SDL_syspower.c b/src/power/macosx/SDL_syspower.c index b6af7682b..16c67f897 100644 --- a/src/power/macosx/SDL_syspower.c +++ b/src/power/macosx/SDL_syspower.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_MACOSX +#ifdef SDL_POWER_MACOSX #include #include diff --git a/src/power/psp/SDL_syspower.c b/src/power/psp/SDL_syspower.c index 281197858..e1f291157 100644 --- a/src/power/psp/SDL_syspower.c +++ b/src/power/psp/SDL_syspower.c @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_PSP +#ifdef SDL_POWER_PSP #include "SDL_power.h" #include diff --git a/src/power/uikit/SDL_syspower.h b/src/power/uikit/SDL_syspower.h index 73149c8a3..9a4600226 100644 --- a/src/power/uikit/SDL_syspower.h +++ b/src/power/uikit/SDL_syspower.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_POWER_UIKIT +#ifdef SDL_POWER_UIKIT #include "SDL_power.h" diff --git a/src/power/uikit/SDL_syspower.m b/src/power/uikit/SDL_syspower.m index 5b9076b57..80ad7abad 100644 --- a/src/power/uikit/SDL_syspower.m +++ b/src/power/uikit/SDL_syspower.m @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_UIKIT +#ifdef SDL_POWER_UIKIT #import diff --git a/src/power/vita/SDL_syspower.c b/src/power/vita/SDL_syspower.c index 6c28e9223..78a8cf826 100644 --- a/src/power/vita/SDL_syspower.c +++ b/src/power/vita/SDL_syspower.c @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_VITA +#ifdef SDL_POWER_VITA #include "SDL_power.h" #include diff --git a/src/power/windows/SDL_syspower.c b/src/power/windows/SDL_syspower.c index f1d7d8897..a431753ae 100644 --- a/src/power/windows/SDL_syspower.c +++ b/src/power/windows/SDL_syspower.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_WINDOWS +#ifdef SDL_POWER_WINDOWS #include "../../core/windows/SDL_windows.h" diff --git a/src/render/SDL_d3dmath.c b/src/render/SDL_d3dmath.c index d1cac1388..3fa92ee2a 100644 --- a/src/render/SDL_d3dmath.c +++ b/src/render/SDL_d3dmath.c @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED +#if (defined(SDL_VIDEO_RENDER_D3D) || defined(SDL_VIDEO_RENDER_D3D11) || defined(SDL_VIDEO_RENDER_D3D12)) && !defined(SDL_RENDER_DISABLED) #include "SDL_stdinc.h" #include "SDL_d3dmath.h" diff --git a/src/render/SDL_d3dmath.h b/src/render/SDL_d3dmath.h index 7383873c1..cb8b42e6c 100644 --- a/src/render/SDL_d3dmath.h +++ b/src/render/SDL_d3dmath.h @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED +#if (defined(SDL_VIDEO_RENDER_D3D) || defined(SDL_VIDEO_RENDER_D3D11) || defined(SDL_VIDEO_RENDER_D3D12)) && !defined(SDL_RENDER_DISABLED) /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index eb717209e..9fae04b3d 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -89,39 +89,39 @@ this should probably be removed at some point in the future. --ryan. */ SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_DST_COLOR, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \ SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD) -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED static const SDL_RenderDriver *render_drivers[] = { -#if SDL_VIDEO_RENDER_D3D +#ifdef SDL_VIDEO_RENDER_D3D &D3D_RenderDriver, #endif -#if SDL_VIDEO_RENDER_D3D11 +#ifdef SDL_VIDEO_RENDER_D3D11 &D3D11_RenderDriver, #endif -#if SDL_VIDEO_RENDER_D3D12 +#ifdef SDL_VIDEO_RENDER_D3D12 &D3D12_RenderDriver, #endif -#if SDL_VIDEO_RENDER_METAL +#ifdef SDL_VIDEO_RENDER_METAL &METAL_RenderDriver, #endif -#if SDL_VIDEO_RENDER_OGL +#ifdef SDL_VIDEO_RENDER_OGL &GL_RenderDriver, #endif -#if SDL_VIDEO_RENDER_OGL_ES2 +#ifdef SDL_VIDEO_RENDER_OGL_ES2 &GLES2_RenderDriver, #endif -#if SDL_VIDEO_RENDER_OGL_ES +#ifdef SDL_VIDEO_RENDER_OGL_ES &GLES_RenderDriver, #endif -#if SDL_VIDEO_RENDER_DIRECTFB +#ifdef SDL_VIDEO_RENDER_DIRECTFB &DirectFB_RenderDriver, #endif -#if SDL_VIDEO_RENDER_PS2 +#ifdef SDL_VIDEO_RENDER_PS2 &PS2_RenderDriver, #endif -#if SDL_VIDEO_RENDER_PSP +#ifdef SDL_VIDEO_RENDER_PSP &PSP_RenderDriver, #endif -#if SDL_VIDEO_RENDER_VITA_GXM +#ifdef SDL_VIDEO_RENDER_VITA_GXM &VITA_GXM_RenderDriver, #endif #if SDL_VIDEO_RENDER_SW @@ -643,7 +643,7 @@ static int UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd int SDL_GetNumRenderDrivers(void) { -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED return SDL_arraysize(render_drivers); #else return 0; @@ -652,7 +652,7 @@ int SDL_GetNumRenderDrivers(void) int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info) { -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED if (index < 0 || index >= SDL_GetNumRenderDrivers()) { return SDL_SetError("index must be in the range of 0 - %d", SDL_GetNumRenderDrivers() - 1); @@ -878,7 +878,7 @@ int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, return 0; } -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED static SDL_INLINE void VerifyDrawQueueFunctions(const SDL_Renderer *renderer) { /* all of these functions are required to be implemented, even as no-ops, so we don't @@ -935,7 +935,7 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) { -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED SDL_Renderer *renderer = NULL; int n = SDL_GetNumRenderDrivers(); SDL_bool batching = SDL_TRUE; @@ -1108,7 +1108,7 @@ error: SDL_Renderer *SDL_CreateSoftwareRenderer(SDL_Surface *surface) { -#if !SDL_RENDER_DISABLED && SDL_VIDEO_RENDER_SW +#if !defined(SDL_RENDER_DISABLED) && SDL_VIDEO_RENDER_SW SDL_Renderer *renderer; renderer = SW_CreateRendererForSurface(surface); @@ -1451,7 +1451,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch); } -#if SDL_VIDEO_RENDER_DIRECTFB +#ifdef SDL_VIDEO_RENDER_DIRECTFB /* DirectFB allows palette format for textures. * Copy SDL_Surface palette to the texture */ if (SDL_ISPIXELFORMAT_INDEXED(format)) { @@ -2284,7 +2284,7 @@ static int UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE); if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) { -#if SDL_VIDEO_RENDER_D3D +#ifdef SDL_VIDEO_RENDER_D3D SDL_bool overscan_supported = SDL_TRUE; /* Unfortunately, Direct3D 9 doesn't support negative viewport numbers which the overscan implementation relies on. diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 4524debac..3bd12414b 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED) #include "../../core/windows/SDL_windows.h" @@ -34,7 +34,7 @@ #include "../SDL_d3dmath.h" #include "../../video/windows/SDL_windowsvideo.h" -#if SDL_VIDEO_RENDER_D3D +#ifdef SDL_VIDEO_RENDER_D3D #define D3D_DEBUG_INFO #include #endif @@ -1739,7 +1739,7 @@ IDirect3DDevice9 *SDL_RenderGetD3D9Device(SDL_Renderer *renderer) { IDirect3DDevice9 *device = NULL; -#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED) D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata; /* Make sure that this is a D3D renderer */ diff --git a/src/render/direct3d/SDL_shaders_d3d.c b/src/render/direct3d/SDL_shaders_d3d.c index e8fd6ae73..fac908487 100644 --- a/src/render/direct3d/SDL_shaders_d3d.c +++ b/src/render/direct3d/SDL_shaders_d3d.c @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED) #include "../../core/windows/SDL_windows.h" diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index 002b7629b..c93879e73 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) #define COBJMACROS #include "../../core/windows/SDL_windows.h" @@ -758,7 +758,7 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h) swapChainDesc.SampleDesc.Quality = 0; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapChainDesc.BufferCount = 2; /* Use double-buffering to minimize latency. */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE swapChainDesc.Scaling = DXGI_SCALING_STRETCH; /* On phone, only stretch and aspect-ratio stretch scaling are allowed. */ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; /* On phone, no swap effects are supported. */ /* TODO, WinRT: see if Win 8.x DXGI_SWAP_CHAIN_DESC1 settings are available on Windows Phone 8.1, and if there's any advantage to having them on */ @@ -907,7 +907,7 @@ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer) if (data->swapChain) { /* IDXGISwapChain::ResizeBuffers is not available on Windows Phone 8. */ -#if !defined(__WINRT__) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#if !defined(__WINRT__) || !SDL_WINAPI_FAMILY_PHONE /* If the swap chain already exists, resize it. */ result = IDXGISwapChain_ResizeBuffers(data->swapChain, 0, @@ -934,7 +934,7 @@ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer) } } -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE /* Set the proper rotation for the swap chain. * * To note, the call for this, IDXGISwapChain1::SetRotation, is not necessary @@ -2237,7 +2237,7 @@ static int D3D11_RenderPresent(SDL_Renderer *renderer) SDL_zero(parameters); -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE syncInterval = 1; presentFlags = 0; result = IDXGISwapChain_Present(data->swapChain, syncInterval, presentFlags); @@ -2285,7 +2285,7 @@ static int D3D11_RenderPresent(SDL_Renderer *renderer) return 0; } -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE /* no-op. */ #else static int D3D11_SetVSync(SDL_Renderer *renderer, const int vsync) @@ -2348,7 +2348,7 @@ SDL_Renderer *D3D11_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE); renderer->driverdata = data; -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE /* VSync is required in Windows Phone, at least for Win Phone 8.0 and 8.1. * Failure to use it seems to either result in: * @@ -2415,7 +2415,7 @@ ID3D11Device *SDL_RenderGetD3D11Device(SDL_Renderer *renderer) { ID3D11Device *device = NULL; -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata; /* Make sure that this is a D3D renderer */ diff --git a/src/render/direct3d11/SDL_render_winrt.cpp b/src/render/direct3d11/SDL_render_winrt.cpp index 4633e11f7..a488582c5 100644 --- a/src/render/direct3d11/SDL_render_winrt.cpp +++ b/src/render/direct3d11/SDL_render_winrt.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) #include "SDL_syswm.h" #include "../../video/winrt/SDL_winrtvideo_cpp.h" @@ -83,7 +83,7 @@ D3D11_GetCurrentRotation() switch (currentOrientation) { -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE /* Windows Phone rotations */ case DisplayOrientations::Landscape: return DXGI_MODE_ROTATION_ROTATE90; @@ -103,7 +103,7 @@ D3D11_GetCurrentRotation() return DXGI_MODE_ROTATION_ROTATE180; case DisplayOrientations::PortraitFlipped: return DXGI_MODE_ROTATION_ROTATE90; -#endif /* WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP */ +#endif /* SDL_WINAPI_FAMILY_PHONE */ } return DXGI_MODE_ROTATION_IDENTITY; diff --git a/src/render/direct3d11/SDL_render_winrt.h b/src/render/direct3d11/SDL_render_winrt.h index efc8c90ae..483f36715 100644 --- a/src/render/direct3d11/SDL_render_winrt.h +++ b/src/render/direct3d11/SDL_render_winrt.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) #include "SDL_render.h" diff --git a/src/render/direct3d11/SDL_shaders_d3d11.c b/src/render/direct3d11/SDL_shaders_d3d11.c index e8c0a48d0..ef3ce7178 100644 --- a/src/render/direct3d11/SDL_shaders_d3d11.c +++ b/src/render/direct3d11/SDL_shaders_d3d11.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED) #include "SDL_stdinc.h" @@ -58,7 +58,7 @@ hexdump -v -e '6/4 "0x%08.8x, " "\n"' */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE #define D3D11_USE_SHADER_MODEL_4_0_level_9_3 #else #define D3D11_USE_SHADER_MODEL_4_0_level_9_1 diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c index bfce68043..3afdbf097 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) #define SDL_D3D12_NUM_BUFFERS 2 #define SDL_D3D12_NUM_VERTEX_BUFFERS 256 @@ -3067,7 +3067,7 @@ extern "C" { ID3D12Device *device = NULL; -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; /* Make sure that this is a D3D renderer */ diff --git a/src/render/direct3d12/SDL_render_d3d12_xbox.cpp b/src/render/direct3d12/SDL_render_d3d12_xbox.cpp index 3775c9448..e444f8b80 100644 --- a/src/render/direct3d12/SDL_render_d3d12_xbox.cpp +++ b/src/render/direct3d12/SDL_render_d3d12_xbox.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && (defined(__XBOXONE__) || defined(__XBOXSERIES__)) +#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) && (defined(__XBOXONE__) || defined(__XBOXSERIES__)) #include "SDL_render_d3d12_xbox.h" #error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." diff --git a/src/render/direct3d12/SDL_shaders_d3d12.c b/src/render/direct3d12/SDL_shaders_d3d12.c index 3b1327291..3de0cc249 100644 --- a/src/render/direct3d12/SDL_shaders_d3d12.c +++ b/src/render/direct3d12/SDL_shaders_d3d12.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_stdinc.h" diff --git a/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp b/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp index 6a86b2c29..e87961328 100644 --- a/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp +++ b/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) +#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) && defined(__XBOXONE__) #error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." diff --git a/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp b/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp index 28651173f..023a449ac 100644 --- a/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp +++ b/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) && defined(__XBOXSERIES__) #error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m index 76d1d834e..34a24e634 100644 --- a/src/render/metal/SDL_render_metal.m +++ b/src/render/metal/SDL_render_metal.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_METAL) && !defined(SDL_RENDER_DISABLED) #include "SDL_hints.h" #include "SDL_syswm.h" diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index c7dc3fc27..8b8c74bd0 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_OGL) && !defined(SDL_RENDER_DISABLED) #include "SDL_hints.h" #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */ #include "SDL_opengl.h" diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c index db2095455..eb85c1f8d 100644 --- a/src/render/opengl/SDL_shaders_gl.c +++ b/src/render/opengl/SDL_shaders_gl.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_OGL) && !defined(SDL_RENDER_DISABLED) #include "SDL_stdinc.h" #include "SDL_opengl.h" diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c index 0b60de8e2..e5cc2f2e9 100644 --- a/src/render/opengles/SDL_render_gles.c +++ b/src/render/opengles/SDL_render_gles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_OGL_ES) && !defined(SDL_RENDER_DISABLED) #include "SDL_hints.h" #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */ @@ -150,11 +150,11 @@ static int GLES_SetError(const char *prefix, GLenum result) static int GLES_LoadFunctions(GLES_RenderData *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif diff --git a/src/render/opengles2/SDL_gles2funcs.h b/src/render/opengles2/SDL_gles2funcs.h index 4a90bced9..82312ca61 100644 --- a/src/render/opengles2/SDL_gles2funcs.h +++ b/src/render/opengles2/SDL_gles2funcs.h @@ -53,7 +53,7 @@ SDL_PROC(void, glPixelStorei, (GLenum, GLint)) SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *)) SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei)) SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei)) -#if __NACL__ +#ifdef __NACL__ SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *)) #else SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *)) diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 1ce23920c..47a02f82e 100644 --- a/src/render/opengles2/SDL_render_gles2.c +++ b/src/render/opengles2/SDL_render_gles2.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_OGL_ES2) && !defined(SDL_RENDER_DISABLED) #include "SDL_hints.h" #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */ @@ -244,11 +244,11 @@ GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, static int GLES2_LoadFunctions(GLES2_RenderData *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif @@ -2137,7 +2137,7 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) goto error; } -#if __WINRT__ +#ifdef __WINRT__ /* DLudwig, 2013-11-29: ANGLE for WinRT doesn't seem to work unless VSync * is turned on. Not doing so will freeze the screen's contents to that * of the first drawn frame. diff --git a/src/render/opengles2/SDL_shaders_gles2.c b/src/render/opengles2/SDL_shaders_gles2.c index 50c86d6ea..d657d7158 100644 --- a/src/render/opengles2/SDL_shaders_gles2.c +++ b/src/render/opengles2/SDL_shaders_gles2.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED +#if defined(SDL_VIDEO_RENDER_OGL_ES2) && !defined(SDL_RENDER_DISABLED) #include "SDL_hints.h" #include "SDL_video.h" diff --git a/src/render/opengles2/SDL_shaders_gles2.h b/src/render/opengles2/SDL_shaders_gles2.h index b358f38f2..7fb687756 100644 --- a/src/render/opengles2/SDL_shaders_gles2.h +++ b/src/render/opengles2/SDL_shaders_gles2.h @@ -23,7 +23,7 @@ #ifndef SDL_shaders_gles2_h_ #define SDL_shaders_gles2_h_ -#if SDL_VIDEO_RENDER_OGL_ES2 +#if defined(SDL_VIDEO_RENDER_OGL_ES2) typedef enum { diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c index f88eac9f3..f5819e82b 100644 --- a/src/render/ps2/SDL_render_ps2.c +++ b/src/render/ps2/SDL_render_ps2.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_PS2 +#ifdef SDL_VIDEO_RENDER_PS2 #include "../SDL_sysrender.h" #include "SDL_hints.h" diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index 892e02820..34159fc8e 100644 --- a/src/render/psp/SDL_render_psp.c +++ b/src/render/psp/SDL_render_psp.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_PSP +#ifdef SDL_VIDEO_RENDER_PSP #include "SDL_hints.h" #include "../SDL_sysrender.h" diff --git a/src/render/software/SDL_blendfillrect.c b/src/render/software/SDL_blendfillrect.c index 876c94d66..4053088ef 100644 --- a/src/render/software/SDL_blendfillrect.c +++ b/src/render/software/SDL_blendfillrect.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) #include "SDL_draw.h" #include "SDL_blendfillrect.h" diff --git a/src/render/software/SDL_blendline.c b/src/render/software/SDL_blendline.c index 1a17a1b56..6c3a39656 100644 --- a/src/render/software/SDL_blendline.c +++ b/src/render/software/SDL_blendline.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) #include "SDL_draw.h" #include "SDL_blendline.h" diff --git a/src/render/software/SDL_blendpoint.c b/src/render/software/SDL_blendpoint.c index 5c781cc06..b2efb027a 100644 --- a/src/render/software/SDL_blendpoint.c +++ b/src/render/software/SDL_blendpoint.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) #include "SDL_draw.h" #include "SDL_blendpoint.h" diff --git a/src/render/software/SDL_drawline.c b/src/render/software/SDL_drawline.c index 77baf59ed..f07de3b9b 100644 --- a/src/render/software/SDL_drawline.c +++ b/src/render/software/SDL_drawline.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) #include "SDL_draw.h" #include "SDL_drawline.h" diff --git a/src/render/software/SDL_drawpoint.c b/src/render/software/SDL_drawpoint.c index bc7763c29..fbd0f5b2d 100644 --- a/src/render/software/SDL_drawpoint.c +++ b/src/render/software/SDL_drawpoint.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) #include "SDL_draw.h" #include "SDL_drawpoint.h" diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c index 3c10313cc..2ef7690f0 100644 --- a/src/render/software/SDL_render_sw.c +++ b/src/render/software/SDL_render_sw.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) #include "../SDL_sysrender.h" #include "SDL_render_sw_c.h" diff --git a/src/render/software/SDL_rotate.c b/src/render/software/SDL_rotate.c index f1c12f7c4..d9faca4d4 100644 --- a/src/render/software/SDL_rotate.c +++ b/src/render/software/SDL_rotate.c @@ -30,7 +30,7 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) #if defined(__WIN32__) || defined(__GDK__) #include "../../core/windows/SDL_windows.h" diff --git a/src/render/software/SDL_triangle.c b/src/render/software/SDL_triangle.c index c1b44abfc..297578d37 100644 --- a/src/render/software/SDL_triangle.c +++ b/src/render/software/SDL_triangle.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED) #include "SDL_surface.h" #include "SDL_triangle.h" diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c index 256d0ef1b..6d8175436 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/src/render/vitagxm/SDL_render_vita_gxm.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_VITA_GXM +#ifdef SDL_VIDEO_RENDER_VITA_GXM #include "SDL_hints.h" #include "../SDL_sysrender.h" @@ -40,7 +40,7 @@ /* #define DEBUG_RAZOR */ -#if DEBUG_RAZOR +#ifdef DEBUG_RAZOR #include #endif @@ -266,7 +266,7 @@ SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags) data->displayData.wait_vblank = SDL_FALSE; } -#if DEBUG_RAZOR +#ifdef DEBUG_RAZOR sceSysmoduleLoadModule(SCE_SYSMODULE_RAZOR_HUD); sceSysmoduleLoadModule(SCE_SYSMODULE_RAZOR_CAPTURE); #endif @@ -1161,7 +1161,7 @@ static int VITA_GXM_RenderPresent(SDL_Renderer *renderer) sceCommonDialogUpdate(&updateParam); -#if DEBUG_RAZOR +#ifdef DEBUG_RAZOR sceGxmPadHeartbeat( (const SceGxmColorSurface *)&data->displaySurface[data->backBufferIndex], (SceGxmSyncObject *)data->displayBufferSync[data->backBufferIndex]); diff --git a/src/render/vitagxm/SDL_render_vita_gxm_memory.c b/src/render/vitagxm/SDL_render_vita_gxm_memory.c index 82b771dcd..7f1da35cd 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm_memory.c +++ b/src/render/vitagxm/SDL_render_vita_gxm_memory.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_VITA_GXM +#ifdef SDL_VIDEO_RENDER_VITA_GXM #include "SDL_render_vita_gxm_memory.h" diff --git a/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/src/render/vitagxm/SDL_render_vita_gxm_tools.c index bb8f6f48f..be02d2480 100644 --- a/src/render/vitagxm/SDL_render_vita_gxm_tools.c +++ b/src/render/vitagxm/SDL_render_vita_gxm_tools.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_VITA_GXM +#ifdef SDL_VIDEO_RENDER_VITA_GXM #include "SDL_hints.h" #include "../SDL_sysrender.h" diff --git a/src/sensor/SDL_sensor.c b/src/sensor/SDL_sensor.c index 15fb7d0d6..22172fa77 100644 --- a/src/sensor/SDL_sensor.c +++ b/src/sensor/SDL_sensor.c @@ -27,7 +27,7 @@ #include "SDL_events.h" #include "SDL_syssensor.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif @@ -75,7 +75,7 @@ int SDL_SensorInit(void) SDL_sensor_lock = SDL_CreateMutex(); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { return -1; } @@ -454,7 +454,7 @@ void SDL_SensorQuit(void) SDL_UnlockSensors(); -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif @@ -479,7 +479,7 @@ int SDL_PrivateSensorUpdate(SDL_Sensor *sensor, Uint64 timestamp_us, float *data /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_SENSORUPDATE) == SDL_ENABLE) { SDL_Event event; event.type = SDL_SENSORUPDATE; diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index c1aa44414..f07559fb2 100644 --- a/src/stdlib/SDL_malloc.c +++ b/src/stdlib/SDL_malloc.c @@ -405,9 +405,9 @@ MALLINFO_FIELD_TYPE default: size_t size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set REALLOC_ZERO_BYTES_FREES default: not defined - This should be set if a call to realloc with zero bytes should - be the same as a call to free. Some people think it should. Otherwise, - since this malloc returns a unique pointer for malloc(0), so does + This should be set if a call to realloc with zero bytes should + be the same as a call to free. Some people think it should. Otherwise, + since this malloc returns a unique pointer for malloc(0), so does realloc(p, 0). LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H @@ -2263,7 +2263,7 @@ static void reset_on_error(mstate m); /* -------------------------- Debugging setup ---------------------------- */ -#if ! DEBUG +#ifndef DEBUG #define check_free_chunk(M,P) #define check_inuse_chunk(M,P) @@ -2627,7 +2627,7 @@ static int change_mparam(int param_number, int value) { } } -#if DEBUG +#ifdef DEBUG /* ------------------------- Debugging Support --------------------------- */ /* Check properties of any chunk, whether free, inuse, mmapped etc */ @@ -3583,7 +3583,7 @@ static void* sys_alloc(mstate m, size_t nb) { m->seg.sflags = mmap_flag; m->magic = mparams.magic; init_bins(m); - if (is_global(m)) + if (is_global(m)) init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); else { /* Offset top by embedded malloc_state */ @@ -3734,7 +3734,7 @@ static int sys_trim(mstate m, size_t pad) { } /* Unmap any unused mmapped segments */ - if (HAVE_MMAP) + if (HAVE_MMAP) released += release_unused_segments(m); /* On failure, disable autotrim to avoid repeated failed future calls */ @@ -3942,7 +3942,7 @@ static void* internal_memalign(mstate m, size_t alignment, size_t bytes) { while (a < alignment) a <<= 1; alignment = a; } - + if (bytes >= MAX_REQUEST - alignment) { if (m != 0) { /* Test isn't needed but avoids compiler warning */ MALLOC_FAILURE_ACTION; @@ -4125,7 +4125,7 @@ static void** ialloc(mstate m, } } -#if DEBUG +#ifdef DEBUG if (marray != chunks) { /* final element must have exactly exhausted chunk */ if (element_size != 0) { @@ -5187,7 +5187,7 @@ History: Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) - + */ #endif /* !HAVE_MALLOC */ diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index a7187195a..9c8163b59 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1121,7 +1121,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) SDL_DisplayMode mode; int bpp; Uint32 Rmask, Gmask, Bmask, Amask; -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS int adapterIndex = 0; int outputIndex = 0; #endif @@ -1184,7 +1184,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) } } -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Print the D3D9 adapter index */ adapterIndex = SDL_Direct3D9GetAdapterIndex(i); SDL_Log("D3D9 Adapter Index: %d", adapterIndex); diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 791035abb..a6c3c0c91 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -119,7 +119,7 @@ SDL_TLSData *SDL_Generic_GetTLSData(void) SDL_TLSEntry *entry; SDL_TLSData *storage = NULL; -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED if (!SDL_generic_TLS_mutex) { static SDL_SpinLock tls_lock; SDL_AtomicLock(&tls_lock); @@ -144,7 +144,7 @@ SDL_TLSData *SDL_Generic_GetTLSData(void) break; } } -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED SDL_UnlockMutex(SDL_generic_TLS_mutex); #endif @@ -202,7 +202,7 @@ static SDL_error *SDL_GetStaticErrBuf() return &SDL_global_error; } -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED static void SDLCALL SDL_FreeErrBuf(void *data) { SDL_error *errbuf = (SDL_error *)data; @@ -217,7 +217,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data) /* Routine to get the thread-specific error variable */ SDL_error *SDL_GetErrBuf(void) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return SDL_GetStaticErrBuf(); #else static SDL_SpinLock tls_lock; diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h index 278a68026..c4d7e74a5 100644 --- a/src/thread/SDL_thread_c.h +++ b/src/thread/SDL_thread_c.h @@ -26,25 +26,25 @@ #include "SDL_thread.h" /* Need the definitions of SYS_ThreadHandle */ -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED #include "generic/SDL_systhread_c.h" -#elif SDL_THREAD_PTHREAD +#elif defined(SDL_THREAD_PTHREAD) #include "pthread/SDL_systhread_c.h" -#elif SDL_THREAD_WINDOWS +#elif defined(SDL_THREAD_WINDOWS) #include "windows/SDL_systhread_c.h" -#elif SDL_THREAD_PS2 +#elif defined(SDL_THREAD_PS2) #include "ps2/SDL_systhread_c.h" -#elif SDL_THREAD_PSP +#elif defined(SDL_THREAD_PSP) #include "psp/SDL_systhread_c.h" -#elif SDL_THREAD_VITA +#elif defined(SDL_THREAD_VITA) #include "vita/SDL_systhread_c.h" -#elif SDL_THREAD_N3DS +#elif defined(SDL_THREAD_N3DS) #include "n3ds/SDL_systhread_c.h" -#elif SDL_THREAD_STDCPP +#elif defined(SDL_THREAD_STDCPP) #include "stdcpp/SDL_systhread_c.h" -#elif SDL_THREAD_OS2 +#elif defined(SDL_THREAD_OS2) #include "os2/SDL_systhread_c.h" -#elif SDL_THREAD_NGAGE +#elif defined(SDL_THREAD_NGAGE) #include "ngage/SDL_systhread_c.h" #else #error Need thread implementation for this platform diff --git a/src/thread/generic/SDL_syscond.c b/src/thread/generic/SDL_syscond.c index d601435a7..059b4303b 100644 --- a/src/thread/generic/SDL_syscond.c +++ b/src/thread/generic/SDL_syscond.c @@ -34,7 +34,7 @@ * will be chosen at runtime), the function names need to be * suffixed */ -#if !SDL_THREAD_GENERIC_COND_SUFFIX +#ifndef SDL_THREAD_GENERIC_COND_SUFFIX #define SDL_CreateCond_generic SDL_CreateCond #define SDL_DestroyCond_generic SDL_DestroyCond #define SDL_CondSignal_generic SDL_CondSignal diff --git a/src/thread/generic/SDL_syscond_c.h b/src/thread/generic/SDL_syscond_c.h index 953f9bcfe..03fdd3d92 100644 --- a/src/thread/generic/SDL_syscond_c.h +++ b/src/thread/generic/SDL_syscond_c.h @@ -25,7 +25,7 @@ #ifndef SDL_syscond_generic_h_ #define SDL_syscond_generic_h_ -#if SDL_THREAD_GENERIC_COND_SUFFIX +#ifdef SDL_THREAD_GENERIC_COND_SUFFIX SDL_cond *SDL_CreateCond_generic(void); void SDL_DestroyCond_generic(SDL_cond *cond); diff --git a/src/thread/generic/SDL_sysmutex.c b/src/thread/generic/SDL_sysmutex.c index 0e77b3a27..08d277054 100644 --- a/src/thread/generic/SDL_sysmutex.c +++ b/src/thread/generic/SDL_sysmutex.c @@ -40,7 +40,7 @@ SDL_mutex *SDL_CreateMutex(void) /* Allocate mutex memory */ mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex)); -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED if (mutex) { /* Create the mutex semaphore, with initial value 1 */ mutex->sem = SDL_CreateSemaphore(1); @@ -72,7 +72,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex) /* Lock the mutex */ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SDL_threadID this_thread; @@ -101,7 +101,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* try Lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else int retval = 0; @@ -133,7 +133,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) /* Unlock the mutex */ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else if (mutex == NULL) { diff --git a/src/thread/generic/SDL_syssem.c b/src/thread/generic/SDL_syssem.c index 3e25a935c..f4d634088 100644 --- a/src/thread/generic/SDL_syssem.c +++ b/src/thread/generic/SDL_syssem.c @@ -26,7 +26,7 @@ #include "SDL_thread.h" #include "SDL_systhread_c.h" -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) { diff --git a/src/thread/ngage/SDL_systhread.cpp b/src/thread/ngage/SDL_systhread.cpp index fb2958da8..be350d2c1 100644 --- a/src/thread/ngage/SDL_systhread.cpp +++ b/src/thread/ngage/SDL_systhread.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_NGAGE +#ifdef SDL_THREAD_NGAGE /* N-Gage thread management routines for SDL */ diff --git a/src/thread/os2/SDL_sysmutex.c b/src/thread/os2/SDL_sysmutex.c index 4a7f6e86e..a2114db6b 100644 --- a/src/thread/os2/SDL_sysmutex.c +++ b/src/thread/os2/SDL_sysmutex.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 /* An implementation of mutexes for OS/2 */ diff --git a/src/thread/os2/SDL_syssem.c b/src/thread/os2/SDL_syssem.c index 7982ac15d..9086cdf8e 100644 --- a/src/thread/os2/SDL_syssem.c +++ b/src/thread/os2/SDL_syssem.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 /* An implementation of semaphores for OS/2 */ diff --git a/src/thread/os2/SDL_systhread.c b/src/thread/os2/SDL_systhread.c index 977f1a69b..03c034590 100644 --- a/src/thread/os2/SDL_systhread.c +++ b/src/thread/os2/SDL_systhread.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 /* Thread management routines for SDL */ diff --git a/src/thread/os2/SDL_systls.c b/src/thread/os2/SDL_systls.c index a6cefc148..69c6b478c 100644 --- a/src/thread/os2/SDL_systls.c +++ b/src/thread/os2/SDL_systls.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 #include "../../core/os2/SDL_os2.h" diff --git a/src/thread/os2/SDL_systls_c.h b/src/thread/os2/SDL_systls_c.h index d79253538..06218d5ba 100644 --- a/src/thread/os2/SDL_systls_c.h +++ b/src/thread/os2/SDL_systls_c.h @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 #include "../SDL_thread_c.h" diff --git a/src/thread/ps2/SDL_syssem.c b/src/thread/ps2/SDL_syssem.c index c54fc992c..f71d81b9d 100644 --- a/src/thread/ps2/SDL_syssem.c +++ b/src/thread/ps2/SDL_syssem.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PS2 +#ifdef SDL_THREAD_PS2 /* Semaphore functions for the PS2. */ diff --git a/src/thread/ps2/SDL_systhread.c b/src/thread/ps2/SDL_systhread.c index 3d2f68520..6e9870d90 100644 --- a/src/thread/ps2/SDL_systhread.c +++ b/src/thread/ps2/SDL_systhread.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PS2 +#ifdef SDL_THREAD_PS2 /* PS2 thread management routines for SDL */ diff --git a/src/thread/psp/SDL_syscond.c b/src/thread/psp/SDL_syscond.c index 8d3741364..1c924126d 100644 --- a/src/thread/psp/SDL_syscond.c +++ b/src/thread/psp/SDL_syscond.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PSP +#ifdef SDL_THREAD_PSP /* An implementation of condition variables using semaphores and mutexes */ /* diff --git a/src/thread/psp/SDL_sysmutex.c b/src/thread/psp/SDL_sysmutex.c index 771be39a2..a1937e34f 100644 --- a/src/thread/psp/SDL_sysmutex.c +++ b/src/thread/psp/SDL_sysmutex.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PSP +#ifdef SDL_THREAD_PSP /* An implementation of mutexes using semaphores */ @@ -75,7 +75,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex) /* Lock the mutex */ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; @@ -96,7 +96,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* Try to lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; @@ -125,7 +125,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) /* Unlock the mutex */ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; diff --git a/src/thread/psp/SDL_syssem.c b/src/thread/psp/SDL_syssem.c index 269553616..8995653f4 100644 --- a/src/thread/psp/SDL_syssem.c +++ b/src/thread/psp/SDL_syssem.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PSP +#ifdef SDL_THREAD_PSP /* Semaphore functions for the PSP. */ diff --git a/src/thread/psp/SDL_systhread.c b/src/thread/psp/SDL_systhread.c index f29efff35..24495fc2b 100644 --- a/src/thread/psp/SDL_systhread.c +++ b/src/thread/psp/SDL_systhread.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PSP +#ifdef SDL_THREAD_PSP /* PSP thread management routines for SDL */ diff --git a/src/thread/pthread/SDL_sysmutex.c b/src/thread/pthread/SDL_sysmutex.c index 6f701974e..53f1b04a6 100644 --- a/src/thread/pthread/SDL_sysmutex.c +++ b/src/thread/pthread/SDL_sysmutex.c @@ -25,15 +25,15 @@ #include "SDL_thread.h" -#if !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX && \ - !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP -#define FAKE_RECURSIVE_MUTEX 1 +#if !(defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX) || \ + defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)) +#define FAKE_RECURSIVE_MUTEX #endif struct SDL_mutex { pthread_mutex_t id; -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX int recursive; pthread_t owner; #endif @@ -48,9 +48,9 @@ SDL_mutex *SDL_CreateMutex(void) mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex)); if (mutex) { pthread_mutexattr_init(&attr); -#if SDL_THREAD_PTHREAD_RECURSIVE_MUTEX +#ifdef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); -#elif SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP +#elif defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP) pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP); #else /* No extra attributes necessary */ @@ -77,7 +77,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex) /* Lock the mutex */ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX pthread_t this_thread; #endif @@ -85,7 +85,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn return 0; } -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX this_thread = pthread_self(); if (mutex->owner == this_thread) { ++mutex->recursive; @@ -113,7 +113,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) { int retval; int result; -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX pthread_t this_thread; #endif @@ -122,7 +122,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) } retval = 0; -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX this_thread = pthread_self(); if (mutex->owner == this_thread) { ++mutex->recursive; @@ -160,7 +160,7 @@ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doe return 0; } -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX /* We can only unlock the mutex if we own it */ if (pthread_self() == mutex->owner) { if (mutex->recursive) { diff --git a/src/thread/pthread/SDL_systhread.c b/src/thread/pthread/SDL_systhread.c index 97eae57c4..604f6fd37 100644 --- a/src/thread/pthread/SDL_systhread.c +++ b/src/thread/pthread/SDL_systhread.c @@ -25,7 +25,7 @@ #include -#if HAVE_PTHREAD_NP_H +#ifdef HAVE_PTHREAD_NP_H #include #endif @@ -141,7 +141,7 @@ void SDL_SYS_SetupThread(const char *name) } #endif } -#elif HAVE_PTHREAD_SETNAME_NP +#elif defined(HAVE_PTHREAD_SETNAME_NP) #if defined(__NETBSD__) pthread_setname_np(pthread_self(), "%s", name); #else @@ -151,7 +151,7 @@ void SDL_SYS_SetupThread(const char *name) pthread_setname_np(pthread_self(), namebuf); } #endif -#elif HAVE_PTHREAD_SET_NAME_NP +#elif defined(HAVE_PTHREAD_SET_NAME_NP) pthread_set_name_np(pthread_self(), name); #elif defined(__HAIKU__) /* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */ @@ -188,7 +188,7 @@ SDL_threadID SDL_ThreadID(void) int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) { -#if __NACL__ || __RISCOS__ || __OS2__ +#if defined(__NACL__) || defined(__RISCOS__) || defined(__OS2__) /* FIXME: Setting thread priority does not seem to be supported in NACL */ return 0; #else @@ -246,7 +246,7 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) policy = pri_policy; } -#if __LINUX__ +#ifdef __LINUX__ { pid_t linuxTid = syscall(SYS_gettid); return SDL_LinuxSetThreadPriorityAndPolicy(linuxTid, priority, policy); diff --git a/src/thread/vita/SDL_syscond.c b/src/thread/vita/SDL_syscond.c index 3d29e6522..e65bfce99 100644 --- a/src/thread/vita/SDL_syscond.c +++ b/src/thread/vita/SDL_syscond.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_VITA +#ifdef SDL_THREAD_VITA /* An implementation of condition variables using semaphores and mutexes */ /* diff --git a/src/thread/vita/SDL_sysmutex.c b/src/thread/vita/SDL_sysmutex.c index aaf14014e..08c4dd048 100644 --- a/src/thread/vita/SDL_sysmutex.c +++ b/src/thread/vita/SDL_sysmutex.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_VITA +#ifdef SDL_THREAD_VITA #include "SDL_thread.h" #include "SDL_systhread_c.h" @@ -71,7 +71,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex) /* Lock the mutex */ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; @@ -92,7 +92,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* Try to lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; @@ -121,7 +121,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) /* Unlock the mutex */ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; diff --git a/src/thread/vita/SDL_syssem.c b/src/thread/vita/SDL_syssem.c index 4b568feb7..7f8b63a73 100644 --- a/src/thread/vita/SDL_syssem.c +++ b/src/thread/vita/SDL_syssem.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_VITA +#ifdef SDL_THREAD_VITA /* Semaphore functions for the VITA. */ diff --git a/src/thread/vita/SDL_systhread.c b/src/thread/vita/SDL_systhread.c index 31f7ab0a8..525157d94 100644 --- a/src/thread/vita/SDL_systhread.c +++ b/src/thread/vita/SDL_systhread.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_VITA +#ifdef SDL_THREAD_VITA /* VITA thread management routines for SDL */ diff --git a/src/thread/windows/SDL_syscond_cv.c b/src/thread/windows/SDL_syscond_cv.c index c96850a75..c09712d08 100644 --- a/src/thread/windows/SDL_syscond_cv.c +++ b/src/thread/windows/SDL_syscond_cv.c @@ -61,7 +61,7 @@ typedef struct CONDITION_VARIABLE } CONDITION_VARIABLE, *PCONDITION_VARIABLE; #endif -#if __WINRT__ +#ifdef __WINRT__ #define pWakeConditionVariable WakeConditionVariable #define pWakeAllConditionVariable WakeAllConditionVariable #define pSleepConditionVariableSRW SleepConditionVariableSRW @@ -235,7 +235,7 @@ SDL_cond *SDL_CreateCond(void) SDL_assert(SDL_mutex_impl_active.Type != SDL_MUTEX_INVALID); } -#if __WINRT__ +#ifdef __WINRT__ /* Link statically on this platform */ impl = &SDL_cond_impl_cv; #else diff --git a/src/thread/windows/SDL_sysmutex.c b/src/thread/windows/SDL_sysmutex.c index 9c377e63d..50f08f44f 100644 --- a/src/thread/windows/SDL_sysmutex.c +++ b/src/thread/windows/SDL_sysmutex.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_WINDOWS +#ifdef SDL_THREAD_WINDOWS /** * Mutex functions using the Win32 API @@ -42,7 +42,7 @@ SDL_mutex_impl_t SDL_mutex_impl_active = { 0 }; * Implementation based on Slim Reader/Writer (SRW) Locks for Win 7 and newer. */ -#if __WINRT__ +#ifdef __WINRT__ /* Functions are guaranteed to be available */ #define pReleaseSRWLockExclusive ReleaseSRWLockExclusive #define pAcquireSRWLockExclusive AcquireSRWLockExclusive @@ -156,7 +156,7 @@ static SDL_mutex *SDL_CreateMutex_cs(void) if (mutex) { /* Initialize */ /* On SMP systems, a non-zero spin count generally helps performance */ -#if __WINRT__ +#ifdef __WINRT__ InitializeCriticalSectionEx(&mutex->cs, 2000, 0); #else InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000); @@ -226,7 +226,7 @@ SDL_mutex *SDL_CreateMutex(void) const SDL_mutex_impl_t *impl = &SDL_mutex_impl_cs; if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, SDL_FALSE)) { -#if __WINRT__ +#ifdef __WINRT__ /* Link statically on this platform */ impl = &SDL_mutex_impl_srw; #else diff --git a/src/thread/windows/SDL_syssem.c b/src/thread/windows/SDL_syssem.c index 6397f0280..62ce9bc5d 100644 --- a/src/thread/windows/SDL_syssem.c +++ b/src/thread/windows/SDL_syssem.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_WINDOWS +#ifdef SDL_THREAD_WINDOWS /** * Semaphore functions using the Win32 API @@ -68,14 +68,8 @@ static SDL_sem_impl_t SDL_sem_impl_active = { 0 }; /* APIs not available on WinPhone 8.1 */ /* https://www.microsoft.com/en-us/download/details.aspx?id=47328 */ -#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP) -#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) -#else -#define SDL_WINAPI_FAMILY_PHONE 0 -#endif - #if !SDL_WINAPI_FAMILY_PHONE -#if __WINRT__ +#ifdef __WINRT__ /* Functions are guaranteed to be available */ #define pWaitOnAddress WaitOnAddress #define pWakeByAddressSingle WakeByAddressSingle @@ -263,7 +257,7 @@ static SDL_sem *SDL_CreateSemaphore_kern(Uint32 initial_value) sem = (SDL_sem_kern *)SDL_malloc(sizeof(*sem)); if (sem) { /* Create the semaphore, with max value 32K */ -#if __WINRT__ +#ifdef __WINRT__ sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS); #else sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL); @@ -385,7 +379,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) #if !SDL_WINAPI_FAMILY_PHONE if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, SDL_FALSE)) { -#if __WINRT__ +#ifdef __WINRT__ /* Link statically on this platform */ impl = &SDL_sem_impl_atom; #else diff --git a/src/thread/windows/SDL_systhread.c b/src/thread/windows/SDL_systhread.c index a2b0c92c9..96d84defa 100644 --- a/src/thread/windows/SDL_systhread.c +++ b/src/thread/windows/SDL_systhread.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_WINDOWS +#ifdef SDL_THREAD_WINDOWS /* Win32 thread management routines for SDL */ diff --git a/src/thread/windows/SDL_systls.c b/src/thread/windows/SDL_systls.c index b4be434fd..3d28114de 100644 --- a/src/thread/windows/SDL_systls.c +++ b/src/thread/windows/SDL_systls.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_THREAD_WINDOWS +#ifdef SDL_THREAD_WINDOWS #include "../../core/windows/SDL_windows.h" diff --git a/src/timer/SDL_timer.c b/src/timer/SDL_timer.c index 5b6fd808d..30c3ac477 100644 --- a/src/timer/SDL_timer.c +++ b/src/timer/SDL_timer.c @@ -28,7 +28,7 @@ /* #define DEBUG_TIMERS */ -#if !defined(__EMSCRIPTEN__) || !SDL_THREADS_DISABLED +#if !defined(__EMSCRIPTEN__) || !defined(SDL_THREADS_DISABLED) typedef struct _SDL_Timer { diff --git a/src/timer/os2/SDL_systimer.c b/src/timer/os2/SDL_systimer.c index 0828300ab..3f589a7fe 100644 --- a/src/timer/os2/SDL_systimer.c +++ b/src/timer/os2/SDL_systimer.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_TIMER_OS2 +#ifdef SDL_TIMER_OS2 #include "SDL_timer.h" #include "../../core/os2/SDL_os2.h" diff --git a/src/timer/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c index 5fe367e13..b0287c3c6 100644 --- a/src/timer/unix/SDL_systimer.c +++ b/src/timer/unix/SDL_systimer.c @@ -46,7 +46,7 @@ Also added OS X Monotonic clock support Based on work in https://github.com/ThomasHabets/monotonic_clock */ -#if HAVE_NANOSLEEP || HAVE_CLOCK_GETTIME +#if defined(HAVE_NANOSLEEP) || defined(HAVE_CLOCK_GETTIME) #include #endif #ifdef __APPLE__ @@ -54,7 +54,7 @@ #endif /* Use CLOCK_MONOTONIC_RAW, if available, which is not subject to adjustment by NTP */ -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME #ifdef CLOCK_MONOTONIC_RAW #define SDL_MONOTONIC_CLOCK CLOCK_MONOTONIC_RAW #else @@ -63,7 +63,7 @@ #endif /* The first ticks value of the application */ -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME static struct timespec start_ts; #elif defined(__APPLE__) static uint64_t start_mach; @@ -81,7 +81,7 @@ void SDL_TicksInit(void) ticks_started = SDL_TRUE; /* Set first ticks value */ -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME if (clock_gettime(SDL_MONOTONIC_CLOCK, &start_ts) == 0) { has_monotonic_time = SDL_TRUE; } else @@ -108,7 +108,7 @@ Uint64 SDL_GetTicks64(void) } if (has_monotonic_time) { -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME struct timespec now; clock_gettime(SDL_MONOTONIC_CLOCK, &now); return (Uint64)(((Sint64)(now.tv_sec - start_ts.tv_sec) * 1000) + ((now.tv_nsec - start_ts.tv_nsec) / 1000000)); @@ -134,7 +134,7 @@ Uint64 SDL_GetPerformanceCounter(void) } if (has_monotonic_time) { -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME struct timespec now; clock_gettime(SDL_MONOTONIC_CLOCK, &now); @@ -165,7 +165,7 @@ Uint64 SDL_GetPerformanceFrequency(void) } if (has_monotonic_time) { -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME return 1000000000; #elif defined(__APPLE__) Uint64 freq = mach_base_info.denom; @@ -182,7 +182,7 @@ void SDL_Delay(Uint32 ms) { int was_error; -#if HAVE_NANOSLEEP +#ifdef HAVE_NANOSLEEP struct timespec elapsed, tv; #else struct timeval tv; @@ -198,7 +198,7 @@ void SDL_Delay(Uint32 ms) #endif /* Set the timeout interval */ -#if HAVE_NANOSLEEP +#ifdef HAVE_NANOSLEEP elapsed.tv_sec = ms / 1000; elapsed.tv_nsec = (ms % 1000) * 1000000; #else @@ -207,7 +207,7 @@ void SDL_Delay(Uint32 ms) do { errno = 0; -#if HAVE_NANOSLEEP +#ifdef HAVE_NANOSLEEP tv.tv_sec = elapsed.tv_sec; tv.tv_nsec = elapsed.tv_nsec; was_error = nanosleep(&tv, &elapsed); diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c index f468b99a3..02c1b7f27 100644 --- a/src/video/SDL_blit_A.c +++ b/src/video/SDL_blit_A.c @@ -412,7 +412,7 @@ static void BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo *info) #endif /* __MMX__ */ -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS void BlitARGBto565PixelAlphaARMSIMDAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint32_t *src, int32_t src_stride); static void BlitARGBto565PixelAlphaARMSIMD(SDL_BlitInfo *info) @@ -442,7 +442,7 @@ static void BlitRGBtoRGBPixelAlphaARMSIMD(SDL_BlitInfo *info) } #endif -#if SDL_ARM_NEON_BLITTERS +#ifdef SDL_ARM_NEON_BLITTERS void BlitARGBto565PixelAlphaARMNEONAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint32_t *src, int32_t src_stride); static void BlitARGBto565PixelAlphaARMNEON(SDL_BlitInfo *info) @@ -1435,14 +1435,14 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface) } case 2: -#if SDL_ARM_NEON_BLITTERS || SDL_ARM_SIMD_BLITTERS +#if defined(SDL_ARM_NEON_BLITTERS) || defined(SDL_ARM_SIMD_BLITTERS) if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000 && sf->Gmask == 0xff00 && df->Gmask == 0x7e0 && ((sf->Rmask == 0xff && df->Rmask == 0x1f) || (sf->Bmask == 0xff && df->Bmask == 0x1f))) { -#if SDL_ARM_NEON_BLITTERS +#ifdef SDL_ARM_NEON_BLITTERS if (SDL_HasNEON()) { return BlitARGBto565PixelAlphaARMNEON; } #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS if (SDL_HasARMSIMD()) { return BlitARGBto565PixelAlphaARMSIMD; } @@ -1475,12 +1475,12 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface) } #endif /* __MMX__ || __3dNOW__ */ if (sf->Amask == 0xff000000) { -#if SDL_ARM_NEON_BLITTERS +#ifdef SDL_ARM_NEON_BLITTERS if (SDL_HasNEON()) { return BlitRGBtoRGBPixelAlphaARMNEON; } #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS if (SDL_HasARMSIMD()) { return BlitRGBtoRGBPixelAlphaARMSIMD; } diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index ca933c344..e03c11932 100644 --- a/src/video/SDL_blit_N.c +++ b/src/video/SDL_blit_N.c @@ -48,7 +48,7 @@ enum blit_features BLIT_FEATURE_HAS_ARM_SIMD = 8 }; -#if SDL_ALTIVEC_BLITTERS +#ifdef SDL_ALTIVEC_BLITTERS #ifdef HAVE_ALTIVEC_H #include #endif @@ -903,7 +903,7 @@ static enum blit_features GetBlitFeatures(void) return features; } -#if __MWERKS__ +#ifdef __MWERKS__ #pragma altivec_model off #endif #else @@ -911,7 +911,7 @@ static enum blit_features GetBlitFeatures(void) #define GetBlitFeatures() ((SDL_HasMMX() ? BLIT_FEATURE_HAS_MMX : 0) | (SDL_HasARMSIMD() ? BLIT_FEATURE_HAS_ARM_SIMD : 0)) #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS void Blit_BGR888_RGB888ARMSIMDAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t *src, int32_t src_stride); static void Blit_BGR888_RGB888ARMSIMD(SDL_BlitInfo *info) @@ -3221,14 +3221,14 @@ static const struct blit_table normal_blit_1[] = { }; static const struct blit_table normal_blit_2[] = { -#if SDL_ALTIVEC_BLITTERS +#ifdef SDL_ALTIVEC_BLITTERS /* has-altivec */ { 0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00000000, 0x00000000, 0x00000000, BLIT_FEATURE_HAS_ALTIVEC, Blit_RGB565_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, { 0x00007C00, 0x000003E0, 0x0000001F, 4, 0x00000000, 0x00000000, 0x00000000, BLIT_FEATURE_HAS_ALTIVEC, Blit_RGB555_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS { 0x00000F00, 0x000000F0, 0x0000000F, 4, 0x00FF0000, 0x0000FF00, 0x000000FF, BLIT_FEATURE_HAS_ARM_SIMD, Blit_RGB444_RGB888ARMSIMD, NO_ALPHA | COPY_ALPHA }, #endif @@ -3288,7 +3288,7 @@ static const struct blit_table normal_blit_3[] = { }; static const struct blit_table normal_blit_4[] = { -#if SDL_ALTIVEC_BLITTERS +#ifdef SDL_ALTIVEC_BLITTERS /* has-altivec | dont-use-prefetch */ { 0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000, 0x00000000, BLIT_FEATURE_HAS_ALTIVEC | BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH, ConvertAltivec32to32_noprefetch, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, @@ -3299,7 +3299,7 @@ static const struct blit_table normal_blit_4[] = { { 0x00000000, 0x00000000, 0x00000000, 2, 0x0000F800, 0x000007E0, 0x0000001F, BLIT_FEATURE_HAS_ALTIVEC, Blit_RGB888_RGB565Altivec, NO_ALPHA }, #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS { 0x000000FF, 0x0000FF00, 0x00FF0000, 4, 0x00FF0000, 0x0000FF00, 0x000000FF, BLIT_FEATURE_HAS_ARM_SIMD, Blit_BGR888_RGB888ARMSIMD, NO_ALPHA | COPY_ALPHA }, #endif @@ -3437,7 +3437,7 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface) } else if (dstfmt->BytesPerPixel == 1) { return BlitNto1Key; } else { -#if SDL_ALTIVEC_BLITTERS +#ifdef SDL_ALTIVEC_BLITTERS if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4) && SDL_HasAltiVec()) { return Blit32to32KeyAltivec; } else diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index 15bf8de85..fb01d42b8 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -20,16 +20,16 @@ */ #include "../SDL_internal.h" -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT +#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) #include "../core/windows/SDL_windows.h" #endif -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include #include "../video/android/SDL_androidvideo.h" #endif -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI #include #endif @@ -57,7 +57,7 @@ #define EGL_PRESENT_OPAQUE_EXT 0x31DF #endif /* EGL_EXT_present_opaque */ -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */ #define DEFAULT_EGL (vc4 ? "libEGL.so.1" : "libbrcmEGL.so") #define DEFAULT_OGL_ES2 (vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so") @@ -66,21 +66,21 @@ #define DEFAULT_OGL_ES_PVR (vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so") #define DEFAULT_OGL_ES (vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so") -#elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE +#elif defined(SDL_VIDEO_DRIVER_ANDROID) || defined(SDL_VIDEO_DRIVER_VIVANTE) /* Android */ #define DEFAULT_EGL "libEGL.so" #define DEFAULT_OGL_ES2 "libGLESv2.so" #define DEFAULT_OGL_ES_PVR "libGLES_CM.so" #define DEFAULT_OGL_ES "libGLESv1_CM.so" -#elif SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT +#elif defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) /* EGL AND OpenGL ES support via ANGLE */ #define DEFAULT_EGL "libEGL.dll" #define DEFAULT_OGL_ES2 "libGLESv2.dll" #define DEFAULT_OGL_ES_PVR "libGLES_CM.dll" #define DEFAULT_OGL_ES "libGLESv1_CM.dll" -#elif SDL_VIDEO_DRIVER_COCOA +#elif defined(SDL_VIDEO_DRIVER_COCOA) /* EGL AND OpenGL ES support via ANGLE */ #define DEFAULT_EGL "libEGL.dylib" #define DEFAULT_OGL_ES2 "libGLESv2.dylib" @@ -105,7 +105,7 @@ #define DEFAULT_OGL_ES "libGLESv1_CM.so.1" #endif /* SDL_VIDEO_DRIVER_RPI */ -#if SDL_VIDEO_OPENGL && !SDL_VIDEO_VITA_PVR_OGL +#if defined(SDL_VIDEO_OPENGL) && !defined(SDL_VIDEO_VITA_PVR_OGL) #include "SDL_opengl.h" #endif @@ -295,14 +295,14 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path) { void *egl_dll_handle = NULL, *opengl_dll_handle = NULL; const char *path = NULL; -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT +#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) const char *d3dcompiler; #endif -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK)); #endif -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT +#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) d3dcompiler = SDL_GetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER); if (d3dcompiler) { if (SDL_strcasecmp(d3dcompiler, "none") != 0) { @@ -419,7 +419,7 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path) #endif _this->egl_data->egl_dll_handle = egl_dll_handle; -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA _this->egl_data->opengl_dll_handle = opengl_dll_handle; #endif @@ -954,7 +954,7 @@ SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) share_context = (EGLContext)SDL_GL_GetCurrentContext(); } -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID if (_this->gl_config.flags & SDL_GL_CONTEXT_DEBUG_FLAG) { /* If SDL_GL_CONTEXT_DEBUG_FLAG is set but EGL_KHR_debug unsupported, unset. * This is required because some Android devices like to complain about it @@ -1065,7 +1065,7 @@ SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) if (SDL_GL_ExtensionSupported("GL_OES_surfaceless_context")) { _this->gl_allow_no_surface = SDL_TRUE; } -#if SDL_VIDEO_OPENGL && !defined(SDL_VIDEO_DRIVER_VITA) +#if defined(SDL_VIDEO_OPENGL) && !defined(SDL_VIDEO_DRIVER_VITA) } else { /* Desktop OpenGL supports it by default from version 3.0 on. */ void(APIENTRY * glGetIntegervFunc)(GLenum pname, GLint * params); @@ -1179,7 +1179,7 @@ void SDL_EGL_DeleteContext(_THIS, SDL_GLContext context) EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) { -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID EGLint format_wanted; EGLint format_got; #endif @@ -1193,7 +1193,7 @@ EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) return EGL_NO_SURFACE; } -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID /* On Android, EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is * guaranteed to be accepted by ANativeWindow_setBuffersGeometry(). */ _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, @@ -1235,7 +1235,7 @@ EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) SDL_EGL_SetError("unable to create an EGL window surface", "eglCreateWindowSurface"); } -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID format_got = ANativeWindow_getFormat(nw); Android_SetFormat(format_wanted, format_got); #endif diff --git a/src/video/SDL_egl_c.h b/src/video/SDL_egl_c.h index feb889a1c..e52afed13 100644 --- a/src/video/SDL_egl_c.h +++ b/src/video/SDL_egl_c.h @@ -23,7 +23,7 @@ #ifndef SDL_egl_h_ #define SDL_egl_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "SDL_egl.h" @@ -42,7 +42,7 @@ typedef struct SDL_EGL_VideoData EGLint egl_required_visual_id; SDL_bool is_offscreen; /* whether EGL display was offscreen */ EGLenum apitype; /* EGL_OPENGL_ES_API, EGL_OPENGL_API, etc */ - + EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display); EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay) (EGLenum platform, void *native_display, @@ -53,21 +53,21 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglInitialize) (EGLDisplay dpy, EGLint * major, EGLint * minor); EGLBoolean(EGLAPIENTRY *eglTerminate) (EGLDisplay dpy); - + void *(EGLAPIENTRY *eglGetProcAddress) (const char * procName); - + EGLBoolean(EGLAPIENTRY *eglChooseConfig) (EGLDisplay dpy, const EGLint * attrib_list, EGLConfig * configs, EGLint config_size, EGLint * num_config); - + EGLContext(EGLAPIENTRY *eglCreateContext) (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint * attrib_list); - + EGLBoolean(EGLAPIENTRY *eglDestroyContext) (EGLDisplay dpy, EGLContext ctx); - + EGLSurface(EGLAPIENTRY *eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, EGLint const* attrib_list); @@ -76,25 +76,25 @@ typedef struct SDL_EGL_VideoData NativeWindowType window, const EGLint * attrib_list); EGLBoolean(EGLAPIENTRY *eglDestroySurface) (EGLDisplay dpy, EGLSurface surface); - + EGLBoolean(EGLAPIENTRY *eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); - + EGLBoolean(EGLAPIENTRY *eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw); - + EGLBoolean(EGLAPIENTRY *eglSwapInterval) (EGLDisplay dpy, EGLint interval); - + const char *(EGLAPIENTRY *eglQueryString) (EGLDisplay dpy, EGLint name); EGLenum(EGLAPIENTRY *eglQueryAPI)(void); - + EGLBoolean(EGLAPIENTRY *eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value); - + EGLBoolean(EGLAPIENTRY *eglWaitNative) (EGLint engine); EGLBoolean(EGLAPIENTRY *eglWaitGL)(void); - + EGLBoolean(EGLAPIENTRY *eglBindAPI)(EGLenum); EGLint(EGLAPIENTRY *eglGetError)(void); @@ -109,7 +109,7 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglDestroySyncKHR)(EGLDisplay dpy, EGLSyncKHR sync); - EGLint(EGLAPIENTRY *eglDupNativeFenceFDANDROID)(EGLDisplay dpy, EGLSyncKHR sync); + EGLint(EGLAPIENTRY *eglDupNativeFenceFDANDROID)(EGLDisplay dpy, EGLSyncKHR sync); EGLint(EGLAPIENTRY *eglWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); diff --git a/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c index 9db592953..fe38a1228 100644 --- a/src/video/SDL_fillrect.c +++ b/src/video/SDL_fillrect.c @@ -249,7 +249,7 @@ int SDL_FillRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color) return SDL_FillRects(dst, rect, 1, color); } -#if SDL_ARM_NEON_BLITTERS +#ifdef SDL_ARM_NEON_BLITTERS void FillRect8ARMNEONAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src); void FillRect16ARMNEONAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src); void FillRect32ARMNEONAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src); @@ -273,7 +273,7 @@ static void fill_32_neon(Uint8 *pixels, int pitch, Uint32 color, int w, int h) } #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS void FillRect8ARMSIMDAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src); void FillRect16ARMSIMDAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src); void FillRect32ARMSIMDAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src); @@ -341,7 +341,7 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, return SDL_SetError("SDL_FillRects(): Unsupported surface format"); } -#if SDL_ARM_NEON_BLITTERS +#ifdef SDL_ARM_NEON_BLITTERS if (SDL_HasNEON() && dst->format->BytesPerPixel != 3 && !fill_function) { switch (dst->format->BytesPerPixel) { case 1: @@ -356,7 +356,7 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, } } #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS if (SDL_HasARMSIMD() && dst->format->BytesPerPixel != 3 && !fill_function) { switch (dst->format->BytesPerPixel) { case 1: diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index ec2bed5cc..57abb238d 100644 --- a/src/video/SDL_stretch.c +++ b/src/video/SDL_stretch.c @@ -334,7 +334,7 @@ static int scale_mat(const Uint32 *src, int src_w, int src_h, int src_pitch, } #if defined(__SSE2__) -#define HAVE_SSE2_INTRINSICS 1 +#define HAVE_SSE2_INTRINSICS #endif #if defined(__ARM_NEON) diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index d7a42cc64..3bfcc00d9 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -433,11 +433,11 @@ struct SDL_VideoDevice void *driverdata; struct SDL_GLDriverData *gl_data; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL struct SDL_EGL_VideoData *egl_data; #endif -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) struct SDL_PrivateGLESData *gles_data; #endif diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index ffc69cdc2..df30097fd 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -34,20 +34,20 @@ #include "SDL_syswm.h" -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include "SDL_opengl.h" #endif /* SDL_VIDEO_OPENGL */ -#if SDL_VIDEO_OPENGL_ES && !SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_OPENGL_ES) && !defined(SDL_VIDEO_OPENGL) #include "SDL_opengles.h" #endif /* SDL_VIDEO_OPENGL_ES && !SDL_VIDEO_OPENGL */ /* GL and GLES2 headers conflict on Linux 32 bits */ -#if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_OPENGL_ES2) && !defined(SDL_VIDEO_OPENGL) #include "SDL_opengles2.h" #endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */ -#if !SDL_VIDEO_OPENGL +#ifndef SDL_VIDEO_OPENGL #ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR #define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB #endif @@ -65,82 +65,82 @@ /* Available video drivers */ static VideoBootStrap *bootstrap[] = { -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA &COCOA_bootstrap, #endif -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 &X11_bootstrap, #endif -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND &Wayland_bootstrap, #endif -#if SDL_VIDEO_DRIVER_VIVANTE +#ifdef SDL_VIDEO_DRIVER_VIVANTE &VIVANTE_bootstrap, #endif -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB &DirectFB_bootstrap, #endif -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS &WINDOWS_bootstrap, #endif -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT &WINRT_bootstrap, #endif -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU &HAIKU_bootstrap, #endif -#if SDL_VIDEO_DRIVER_PANDORA +#ifdef SDL_VIDEO_DRIVER_PANDORA &PND_bootstrap, #endif -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT &UIKIT_bootstrap, #endif -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID &Android_bootstrap, #endif -#if SDL_VIDEO_DRIVER_PS2 +#ifdef SDL_VIDEO_DRIVER_PS2 &PS2_bootstrap, #endif -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP &PSP_bootstrap, #endif -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA &VITA_bootstrap, #endif -#if SDL_VIDEO_DRIVER_N3DS +#ifdef SDL_VIDEO_DRIVER_N3DS &N3DS_bootstrap, #endif -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM &KMSDRM_bootstrap, #endif -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS &RISCOS_bootstrap, #endif -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI &RPI_bootstrap, #endif -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL &NACL_bootstrap, #endif -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN &Emscripten_bootstrap, #endif -#if SDL_VIDEO_DRIVER_QNX +#ifdef SDL_VIDEO_DRIVER_QNX &QNX_bootstrap, #endif -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 &OS2DIVE_bootstrap, &OS2VMAN_bootstrap, #endif -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE &NGAGE_bootstrap, #endif -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN &OFFSCREEN_bootstrap, #endif -#if SDL_VIDEO_DRIVER_DUMMY +#ifdef SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV &DUMMY_evdev_bootstrap, #endif #endif @@ -202,12 +202,12 @@ typedef struct static Uint32 SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this) { -#if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__ +#if (defined(SDL_VIDEO_OPENGL) && defined(__MACOSX__)) || (defined(__IPHONEOS__) && !TARGET_OS_MACCATALYST) || defined(__ANDROID__) || defined(__NACL__) if (_this->GL_CreateContext) { return SDL_WINDOW_OPENGL; } #endif -#if SDL_VIDEO_METAL && (TARGET_OS_MACCATALYST || __MACOSX__ || __IPHONEOS__) +#if defined(SDL_VIDEO_METAL) && (TARGET_OS_MACCATALYST || defined(__MACOSX__) || defined(__IPHONEOS__)) if (_this->Metal_CreateView) { return SDL_WINDOW_METAL; } @@ -441,7 +441,7 @@ int SDL_VideoInit(const char *driver_name) SDL_VideoQuit(); } -#if !SDL_TIMERS_DISABLED +#ifndef SDL_TIMERS_DISABLED SDL_TicksInit(); #endif @@ -1332,7 +1332,7 @@ static void SDL_RestoreMousePosition(SDL_Window *window) } } -#if __WINRT__ +#ifdef __WINRT__ extern Uint32 WINRT_DetectWindowFlags(SDL_Window *window); #endif @@ -1379,7 +1379,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen) return 0; } } -#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) +#elif defined(__WINRT__) && (NTDDI_VERSION < NTDDI_WIN10) /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen or not. The user can choose this, via OS-provided UI, but this can't be set programmatically. @@ -1779,7 +1779,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint } #endif -#if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) +#if defined(__WINRT__) && (NTDDI_VERSION < NTDDI_WIN10) /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen or not. The user can choose this, via OS-provided UI, but this can't be set programmatically. @@ -3454,7 +3454,7 @@ void SDL_GL_UnloadLibrary(void) } } -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr) { return verstr && (SDL_atoi(verstr) >= 3); @@ -3463,7 +3463,7 @@ static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr) SDL_bool SDL_GL_ExtensionSupported(const char *extension) { -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) const GLubyte *(APIENTRY * glGetStringFunc)(GLenum); const char *extensions; const char *start; @@ -3557,7 +3557,7 @@ void SDL_GL_DeduceMaxSupportedESProfile(int *major, int *minor) { /* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */ /* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */ -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) /* XXX This is fragile; it will break in the event of release of * new versions of OpenGL ES. */ @@ -3602,15 +3602,15 @@ void SDL_GL_ResetAttributes() _this->gl_config.retained_backing = 1; _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _this->gl_config.major_version = 2; _this->gl_config.minor_version = 1; _this->gl_config.profile_mask = 0; -#elif SDL_VIDEO_OPENGL_ES2 +#elif defined(SDL_VIDEO_OPENGL_ES2) _this->gl_config.major_version = 2; _this->gl_config.minor_version = 0; _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; -#elif SDL_VIDEO_OPENGL_ES +#elif defined(SDL_VIDEO_OPENGL_ES) _this->gl_config.major_version = 1; _this->gl_config.minor_version = 1; _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; @@ -3633,7 +3633,7 @@ void SDL_GL_ResetAttributes() int SDL_GL_SetAttribute(SDL_GLattr attr, int value) { -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) int retval; if (!_this) { @@ -3756,7 +3756,7 @@ int SDL_GL_SetAttribute(SDL_GLattr attr, int value) int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) { -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) GLenum(APIENTRY * glGetErrorFunc)(void); GLenum attrib = 0; GLenum error = 0; @@ -3767,7 +3767,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) * the enums we use for the former function don't exist in OpenGL ES 2, and * the function itself doesn't exist prior to OpenGL 3 and OpenGL ES 2. */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL const GLubyte *(APIENTRY * glGetStringFunc)(GLenum name); void(APIENTRY * glGetFramebufferAttachmentParameterivFunc)(GLenum target, GLenum attachment, GLenum pname, GLint * params); GLenum attachment = GL_BACK_LEFT; @@ -3787,31 +3787,31 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) switch (attr) { case SDL_GL_RED_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE; #endif attrib = GL_RED_BITS; break; case SDL_GL_BLUE_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE; #endif attrib = GL_BLUE_BITS; break; case SDL_GL_GREEN_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE; #endif attrib = GL_GREEN_BITS; break; case SDL_GL_ALPHA_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE; #endif attrib = GL_ALPHA_BITS; break; case SDL_GL_DOUBLEBUFFER: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attrib = GL_DOUBLEBUFFER; break; #else @@ -3822,20 +3822,20 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) return 0; #endif case SDL_GL_DEPTH_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachment = GL_DEPTH; attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE; #endif attrib = GL_DEPTH_BITS; break; case SDL_GL_STENCIL_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachment = GL_STENCIL; attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE; #endif attrib = GL_STENCIL_BITS; break; -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL case SDL_GL_ACCUM_RED_SIZE: attrib = GL_ACCUM_RED_BITS; break; @@ -3868,7 +3868,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) attrib = GL_SAMPLES; break; case SDL_GL_CONTEXT_RELEASE_BEHAVIOR: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attrib = GL_CONTEXT_RELEASE_BEHAVIOR; #else attrib = GL_CONTEXT_RELEASE_BEHAVIOR_KHR; @@ -3955,7 +3955,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) return SDL_SetError("Unknown OpenGL attribute"); } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); if (!glGetStringFunc) { return -1; @@ -4369,41 +4369,41 @@ int SDL_GetMessageBoxCount(void) return SDL_AtomicGet(&SDL_messagebox_count); } -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "android/SDL_androidmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "windows/SDL_windowsmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT #include "winrt/SDL_winrtmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "cocoa/SDL_cocoamessagebox.h" #endif -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "uikit/SDL_uikitmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "x11/SDL_x11messagebox.h" #endif -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "wayland/SDL_waylandmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "haiku/SDL_bmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 #include "os2/SDL_os2messagebox.h" #endif -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "riscos/SDL_riscosmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include "vita/SDL_vitamessagebox.h" #endif -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_OS2 || SDL_VIDEO_DRIVER_RISCOS +#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) || defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT) || defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_HAIKU) || defined(SDL_VIDEO_DRIVER_OS2) || defined(SDL_VIDEO_DRIVER_RISCOS) static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; @@ -4466,76 +4466,76 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } /* It's completely fine to call this function before video is initialized */ -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID if (retval == -1 && Android_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINDOWS) && WIN_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINRT) && WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_COCOA) && Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_UIKIT) && UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) && X11_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WAYLAND) && Wayland_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) && HAIKU_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_OS2) && OS2_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS if (retval == -1 && SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_RISCOS) && RISCOS_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA if (retval == -1 && VITA_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; diff --git a/src/video/SDL_vulkan_internal.h b/src/video/SDL_vulkan_internal.h index ff731c344..ea6118552 100644 --- a/src/video/SDL_vulkan_internal.h +++ b/src/video/SDL_vulkan_internal.h @@ -25,34 +25,34 @@ #include "SDL_stdinc.h" -#if SDL_VIDEO_VULKAN -#if SDL_LOADSO_DISABLED || SDL_LOADSO_DUMMY +#ifdef SDL_VIDEO_VULKAN +#if defined(SDL_LOADSO_DISABLED) || defined(SDL_LOADSO_DUMMY) #error You should not be here. #endif -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #define VK_USE_PLATFORM_ANDROID_KHR #endif -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #define VK_USE_PLATFORM_METAL_EXT #define VK_USE_PLATFORM_MACOS_MVK #endif -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #define VK_USE_PLATFORM_DIRECTFB_EXT #endif -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define VK_USE_PLATFORM_METAL_EXT #define VK_USE_PLATFORM_IOS_MVK #endif -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #define VK_USE_PLATFORM_WAYLAND_KHR #include "wayland/SDL_waylanddyn.h" #endif -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #define VK_USE_PLATFORM_WIN32_KHR #include "../core/windows/SDL_windows.h" #endif -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #define VK_USE_PLATFORM_XLIB_KHR #define VK_USE_PLATFORM_XCB_KHR #endif diff --git a/src/video/SDL_vulkan_utils.c b/src/video/SDL_vulkan_utils.c index 04ba664b1..0c93efd9d 100644 --- a/src/video/SDL_vulkan_utils.c +++ b/src/video/SDL_vulkan_utils.c @@ -23,7 +23,7 @@ #include "SDL_vulkan_internal.h" #include "SDL_error.h" -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN const char *SDL_Vulkan_GetResultString(VkResult result) { diff --git a/src/video/android/SDL_androidclipboard.c b/src/video/android/SDL_androidclipboard.c index bd80a0100..93519f90e 100644 --- a/src/video/android/SDL_androidclipboard.c +++ b/src/video/android/SDL_androidclipboard.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidvideo.h" #include "SDL_androidclipboard.h" diff --git a/src/video/android/SDL_androidevents.c b/src/video/android/SDL_androidevents.c index b15239828..8efb67543 100644 --- a/src/video/android/SDL_androidevents.c +++ b/src/video/android/SDL_androidevents.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidevents.h" #include "SDL_events.h" @@ -32,7 +32,7 @@ /* Can't include sysaudio "../../audio/android/SDL_androidaudio.h" * because of THIS redefinition */ -#if !SDL_AUDIO_DISABLED && SDL_AUDIO_DRIVER_ANDROID +#if !defined(SDL_AUDIO_DISABLED) && defined(SDL_AUDIO_DRIVER_ANDROID) extern void ANDROIDAUDIO_ResumeDevices(void); extern void ANDROIDAUDIO_PauseDevices(void); #else @@ -40,7 +40,7 @@ static void ANDROIDAUDIO_ResumeDevices(void) {} static void ANDROIDAUDIO_PauseDevices(void) {} #endif -#if !SDL_AUDIO_DISABLED && SDL_AUDIO_DRIVER_OPENSLES +#if !defined(SDL_AUDIO_DISABLED) && defined(SDL_AUDIO_DRIVER_OPENSLES) extern void openslES_ResumeDevices(void); extern void openslES_PauseDevices(void); #else @@ -50,7 +50,7 @@ static void openslES_ResumeDevices(void) static void openslES_PauseDevices(void) {} #endif -#if !SDL_AUDIO_DISABLED && SDL_AUDIO_DRIVER_AAUDIO +#if !defined(SDL_AUDIO_DISABLED) && defined(SDL_AUDIO_DRIVER_AAUDIO) extern void aaudio_ResumeDevices(void); extern void aaudio_PauseDevices(void); SDL_bool aaudio_DetectBrokenPlayState(void); @@ -68,7 +68,7 @@ static int SDL_NumberOfEvents(Uint32 type) return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type); } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL static void android_egl_context_restore(SDL_Window *window) { if (window) { @@ -113,7 +113,7 @@ void Android_PumpEvents_Blocking(_THIS) if (videodata->isPaused) { SDL_bool isContextExternal = SDL_IsVideoContextExternal(); -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Make sure this is the last thing we do before pausing */ if (!isContextExternal) { SDL_LockMutex(Android_ActivityMutex); @@ -140,7 +140,7 @@ void Android_PumpEvents_Blocking(_THIS) aaudio_ResumeDevices(); /* Restore the GL Context from here, as this operation is thread dependent */ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_restore(Android_Window); @@ -191,7 +191,7 @@ void Android_PumpEvents_NonBlocking(_THIS) SDL_bool isContextExternal = SDL_IsVideoContextExternal(); if (backup_context) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (!isContextExternal) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_backup(Android_Window); @@ -223,7 +223,7 @@ void Android_PumpEvents_NonBlocking(_THIS) aaudio_ResumeDevices(); } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Restore the GL Context from here, as this operation is thread dependent */ if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { SDL_LockMutex(Android_ActivityMutex); diff --git a/src/video/android/SDL_androidgl.c b/src/video/android/SDL_androidgl.c index e54dbbed1..ea0d4e7cb 100644 --- a/src/video/android/SDL_androidgl.c +++ b/src/video/android/SDL_androidgl.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_ANDROID) && defined(SDL_VIDEO_OPENGL_EGL) /* Android SDL video driver implementation */ diff --git a/src/video/android/SDL_androidkeyboard.c b/src/video/android/SDL_androidkeyboard.c index 1d8fbb991..24f72811c 100644 --- a/src/video/android/SDL_androidkeyboard.c +++ b/src/video/android/SDL_androidkeyboard.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include diff --git a/src/video/android/SDL_androidmessagebox.c b/src/video/android/SDL_androidmessagebox.c index 81f6f38a6..cbaf8f9eb 100644 --- a/src/video/android/SDL_androidmessagebox.c +++ b/src/video/android/SDL_androidmessagebox.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_messagebox.h" #include "SDL_androidmessagebox.h" diff --git a/src/video/android/SDL_androidmessagebox.h b/src/video/android/SDL_androidmessagebox.h index 9dabc9e4d..256d509fa 100644 --- a/src/video/android/SDL_androidmessagebox.h +++ b/src/video/android/SDL_androidmessagebox.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID extern int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/src/video/android/SDL_androidmouse.c b/src/video/android/SDL_androidmouse.c index ddb99eb45..a02d59984 100644 --- a/src/video/android/SDL_androidmouse.c +++ b/src/video/android/SDL_androidmouse.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidmouse.h" diff --git a/src/video/android/SDL_androidtouch.c b/src/video/android/SDL_androidtouch.c index 3cf925d8a..ae1d716be 100644 --- a/src/video/android/SDL_androidtouch.c +++ b/src/video/android/SDL_androidtouch.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c index 0e4e3d1a7..930140b1e 100644 --- a/src/video/android/SDL_androidvideo.c +++ b/src/video/android/SDL_androidvideo.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID /* Android SDL video driver implementation */ @@ -125,7 +125,7 @@ static SDL_VideoDevice *Android_CreateDevice(void) device->free = Android_DeleteDevice; /* GL pointers */ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Android_GLES_LoadLibrary; device->GL_GetProcAddress = Android_GLES_GetProcAddress; device->GL_UnloadLibrary = Android_GLES_UnloadLibrary; @@ -137,7 +137,7 @@ static SDL_VideoDevice *Android_CreateDevice(void) device->GL_DeleteContext = Android_GLES_DeleteContext; #endif -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = Android_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = Android_Vulkan_GetInstanceExtensions; diff --git a/src/video/android/SDL_androidvulkan.c b/src/video/android/SDL_androidvulkan.c index 6008a521c..ea7231ff5 100644 --- a/src/video/android/SDL_androidvulkan.c +++ b/src/video/android/SDL_androidvulkan.c @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_ANDROID) #include "SDL_androidvideo.h" #include "SDL_androidwindow.h" diff --git a/src/video/android/SDL_androidvulkan.h b/src/video/android/SDL_androidvulkan.h index 5e39d93a9..c3f46652e 100644 --- a/src/video/android/SDL_androidvulkan.h +++ b/src/video/android/SDL_androidvulkan.h @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_ANDROID) int Android_Vulkan_LoadLibrary(_THIS, const char *path); void Android_Vulkan_UnloadLibrary(_THIS); diff --git a/src/video/android/SDL_androidwindow.c b/src/video/android/SDL_androidwindow.c index e38ce7e23..dd5b40a23 100644 --- a/src/video/android/SDL_androidwindow.c +++ b/src/video/android/SDL_androidwindow.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_syswm.h" #include "../SDL_sysvideo.h" @@ -80,7 +80,7 @@ int Android_CreateWindow(_THIS, SDL_Window *window) /* Do not create EGLSurface for Vulkan window since it will then make the window incompatible with vkCreateAndroidSurfaceKHR */ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)data->native_window); @@ -180,7 +180,7 @@ void Android_DestroyWindow(_THIS, SDL_Window *window) if (window->driverdata) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } @@ -205,7 +205,7 @@ SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info) info->subsystem = SDL_SYSWM_ANDROID; info->info.android.window = data->native_window; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL info->info.android.surface = data->egl_surface; #endif diff --git a/src/video/android/SDL_androidwindow.h b/src/video/android/SDL_androidwindow.h index 1d529365c..1635c4601 100644 --- a/src/video/android/SDL_androidwindow.h +++ b/src/video/android/SDL_androidwindow.h @@ -38,7 +38,7 @@ extern SDL_Window *Android_Window; typedef struct { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; EGLContext egl_context; /* We use this to preserve the context when losing focus */ #endif diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m index c64f2e476..d42a439e9 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.m +++ b/src/video/cocoa/SDL_cocoaclipboard.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_cocoavideo.h" #include "../../events/SDL_clipboardevents_c.h" diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index 99db10c69..b1eabe88c 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_timer.h" diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index 08ee18d50..c81880d32 100644 --- a/src/video/cocoa/SDL_cocoakeyboard.m +++ b/src/video/cocoa/SDL_cocoakeyboard.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_cocoavideo.h" @@ -460,7 +460,7 @@ extern CGError CGSSetGlobalHotKeyOperatingMode(CGSConnection connection, CGSGlob void Cocoa_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { -#if SDL_MAC_NO_SANDBOX +#ifdef SDL_MAC_NO_SANDBOX CGSSetGlobalHotKeyOperatingMode(_CGSDefaultConnection(), grabbed ? CGSGlobalHotKeyDisable : CGSGlobalHotKeyEnable); #endif } diff --git a/src/video/cocoa/SDL_cocoamessagebox.h b/src/video/cocoa/SDL_cocoamessagebox.h index 2893cd2dc..126482e26 100644 --- a/src/video/cocoa/SDL_cocoamessagebox.h +++ b/src/video/cocoa/SDL_cocoamessagebox.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA extern int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/src/video/cocoa/SDL_cocoamessagebox.m b/src/video/cocoa/SDL_cocoamessagebox.m index a8f29a9b8..a2002864c 100644 --- a/src/video/cocoa/SDL_cocoamessagebox.m +++ b/src/video/cocoa/SDL_cocoamessagebox.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_events.h" #include "SDL_timer.h" diff --git a/src/video/cocoa/SDL_cocoametalview.h b/src/video/cocoa/SDL_cocoametalview.h index 22571eb91..e508e0fe5 100644 --- a/src/video/cocoa/SDL_cocoametalview.h +++ b/src/video/cocoa/SDL_cocoametalview.h @@ -29,7 +29,7 @@ #ifndef SDL_cocoametalview_h_ #define SDL_cocoametalview_h_ -#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) +#if defined(SDL_VIDEO_DRIVER_COCOA) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)) #import "../SDL_sysvideo.h" diff --git a/src/video/cocoa/SDL_cocoametalview.m b/src/video/cocoa/SDL_cocoametalview.m index fab4652e7..a5ef8fce3 100644 --- a/src/video/cocoa/SDL_cocoametalview.m +++ b/src/video/cocoa/SDL_cocoametalview.m @@ -28,7 +28,7 @@ #import "SDL_cocoametalview.h" -#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) +#if defined(SDL_VIDEO_DRIVER_COCOA) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)) #include "SDL_events.h" #include "SDL_syswm.h" diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index 0517302af..79c34209e 100644 --- a/src/video/cocoa/SDL_cocoamodes.m +++ b/src/video/cocoa/SDL_cocoamodes.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_cocoavideo.h" diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index e85e16c9f..29e2680ee 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_events.h" #include "SDL_cocoamouse.h" diff --git a/src/video/cocoa/SDL_cocoaopengl.h b/src/video/cocoa/SDL_cocoaopengl.h index 0bd549fc9..ade94b714 100644 --- a/src/video/cocoa/SDL_cocoaopengl.h +++ b/src/video/cocoa/SDL_cocoaopengl.h @@ -23,7 +23,7 @@ #ifndef SDL_cocoaopengl_h_ #define SDL_cocoaopengl_h_ -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL #include "SDL_atomic.h" #import diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index 0ac8e3e24..1acb80f94 100644 --- a/src/video/cocoa/SDL_cocoaopengl.m +++ b/src/video/cocoa/SDL_cocoaopengl.m @@ -22,7 +22,7 @@ /* NSOpenGL implementation of SDL OpenGL support */ -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL #include "SDL_cocoavideo.h" #include "SDL_cocoaopengl.h" #include "SDL_cocoaopengles.h" @@ -270,7 +270,7 @@ SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window * window) int interval; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Switch to EGL based functions */ Cocoa_GL_UnloadLibrary(_this); _this->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; diff --git a/src/video/cocoa/SDL_cocoaopengles.h b/src/video/cocoa/SDL_cocoaopengles.h index 123076215..d585cf3a8 100644 --- a/src/video/cocoa/SDL_cocoaopengles.h +++ b/src/video/cocoa/SDL_cocoaopengles.h @@ -23,7 +23,7 @@ #ifndef SDL_cocoaopengles_h_ #define SDL_cocoaopengles_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/src/video/cocoa/SDL_cocoaopengles.m b/src/video/cocoa/SDL_cocoaopengles.m index 17f0b4cb7..44fe826f4 100644 --- a/src/video/cocoa/SDL_cocoaopengles.m +++ b/src/video/cocoa/SDL_cocoaopengles.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_COCOA) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_cocoavideo.h" #include "SDL_cocoaopengles.h" @@ -32,7 +32,7 @@ int Cocoa_GLES_LoadLibrary(_THIS, const char *path) { /* If the profile requested is not GL ES, switch over to WIN_GL functions */ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL Cocoa_GLES_UnloadLibrary(_this); _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary; _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress; @@ -62,7 +62,7 @@ SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window * window) SDL_GLContext context; SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { /* Switch to CGL based functions */ Cocoa_GLES_UnloadLibrary(_this); diff --git a/src/video/cocoa/SDL_cocoashape.m b/src/video/cocoa/SDL_cocoashape.m index 2fd9f5946..76987a450 100644 --- a/src/video/cocoa/SDL_cocoashape.m +++ b/src/video/cocoa/SDL_cocoashape.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_cocoavideo.h" #include "SDL_shape.h" diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index a626b1b40..fd47f6c2d 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #if !__has_feature(objc_arc) #error SDL must be built with Objective-C ARC (automatic reference counting) enabled @@ -127,7 +127,7 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void) device->shape_driver.SetWindowShape = Cocoa_SetWindowShape; device->shape_driver.ResizeWindowShape = Cocoa_ResizeWindowShape; -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL device->GL_LoadLibrary = Cocoa_GL_LoadLibrary; device->GL_GetProcAddress = Cocoa_GL_GetProcAddress; device->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary; @@ -137,7 +137,7 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void) device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; device->GL_SwapWindow = Cocoa_GL_SwapWindow; device->GL_DeleteContext = Cocoa_GL_DeleteContext; -#elif SDL_VIDEO_OPENGL_EGL +#elif defined(SDL_VIDEO_OPENGL_EGL) device->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; device->GL_GetProcAddress = Cocoa_GLES_GetProcAddress; device->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary; @@ -149,7 +149,7 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void) device->GL_DeleteContext = Cocoa_GLES_DeleteContext; #endif -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = Cocoa_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = Cocoa_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = Cocoa_Vulkan_GetInstanceExtensions; @@ -157,7 +157,7 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void) device->Vulkan_GetDrawableSize = Cocoa_Vulkan_GetDrawableSize; #endif -#if SDL_VIDEO_METAL +#ifdef SDL_VIDEO_METAL device->Metal_CreateView = Cocoa_Metal_CreateView; device->Metal_DestroyView = Cocoa_Metal_DestroyView; device->Metal_GetLayer = Cocoa_Metal_GetLayer; diff --git a/src/video/cocoa/SDL_cocoavulkan.h b/src/video/cocoa/SDL_cocoavulkan.h index 85fc1f3c5..dc7aace5c 100644 --- a/src/video/cocoa/SDL_cocoavulkan.h +++ b/src/video/cocoa/SDL_cocoavulkan.h @@ -33,7 +33,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_COCOA) int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path); void Cocoa_Vulkan_UnloadLibrary(_THIS); diff --git a/src/video/cocoa/SDL_cocoavulkan.m b/src/video/cocoa/SDL_cocoavulkan.m index 7481326f0..d4926e3dc 100644 --- a/src/video/cocoa/SDL_cocoavulkan.m +++ b/src/video/cocoa/SDL_cocoavulkan.m @@ -25,7 +25,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_COCOA) #include "SDL_cocoavideo.h" #include "SDL_cocoawindow.h" diff --git a/src/video/cocoa/SDL_cocoawindow.h b/src/video/cocoa/SDL_cocoawindow.h index 7ed00fe63..00860c051 100644 --- a/src/video/cocoa/SDL_cocoawindow.h +++ b/src/video/cocoa/SDL_cocoawindow.h @@ -25,7 +25,7 @@ #import -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_egl_c.h" #endif @@ -132,7 +132,7 @@ typedef enum @property (nonatomic) NSInteger flash_request; @property (nonatomic) Cocoa_WindowListener *listener; @property (nonatomic) SDL_VideoData *videodata; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL @property (nonatomic) EGLSurface egl_surface; #endif @end diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index f586bdb61..9f4f05982 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 # error SDL for Mac OS X must be built with a 10.7 SDK or above. @@ -260,7 +260,7 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r) static void ScheduleContextUpdates(SDL_WindowData *data) { /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ - #if SDL_VIDEO_OPENGL + #ifdef SDL_VIDEO_OPENGL #ifdef __clang__ #pragma clang diagnostic push @@ -1788,8 +1788,8 @@ int Cocoa_CreateWindow(_THIS, SDL_Window * window) #pragma clang diagnostic pop #endif -#if SDL_VIDEO_OPENGL_ES2 -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_ES2 +#ifdef SDL_VIDEO_OPENGL_EGL if ((window->flags & SDL_WINDOW_OPENGL) && _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { [contentView setWantsLayer:TRUE]; @@ -1807,9 +1807,9 @@ int Cocoa_CreateWindow(_THIS, SDL_Window * window) } /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ -#if SDL_VIDEO_OPENGL_ES2 +#ifdef SDL_VIDEO_OPENGL_ES2 if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (Cocoa_GLES_SetupWindow(_this, window) < 0) { Cocoa_DestroyWindow(_this, window); return -1; @@ -2344,7 +2344,7 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window) [data.nswindow close]; } - #if SDL_VIDEO_OPENGL + #ifdef SDL_VIDEO_OPENGL contexts = [data.nscontexts copy]; for (SDLOpenGLContext *context in contexts) { diff --git a/src/video/directfb/SDL_DirectFB_WM.c b/src/video/directfb/SDL_DirectFB_WM.c index 4b3fedb74..ed7dab4be 100644 --- a/src/video/directfb/SDL_DirectFB_WM.c +++ b/src/video/directfb/SDL_DirectFB_WM.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_window.h" diff --git a/src/video/directfb/SDL_DirectFB_dyn.c b/src/video/directfb/SDL_DirectFB_dyn.c index 6131d9f92..da82ee137 100644 --- a/src/video/directfb/SDL_DirectFB_dyn.c +++ b/src/video/directfb/SDL_DirectFB_dyn.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_dyn.h" diff --git a/src/video/directfb/SDL_DirectFB_events.c b/src/video/directfb/SDL_DirectFB_events.c index 16d073c1d..ac9dfee4c 100644 --- a/src/video/directfb/SDL_DirectFB_events.c +++ b/src/video/directfb/SDL_DirectFB_events.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB /* Handle the event stream, converting DirectFB input events into SDL events */ diff --git a/src/video/directfb/SDL_DirectFB_modes.c b/src/video/directfb/SDL_DirectFB_modes.c index 135b0843a..27de65436 100644 --- a/src/video/directfb/SDL_DirectFB_modes.c +++ b/src/video/directfb/SDL_DirectFB_modes.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_modes.h" diff --git a/src/video/directfb/SDL_DirectFB_mouse.c b/src/video/directfb/SDL_DirectFB_mouse.c index d0e1f291c..65d2d7c51 100644 --- a/src/video/directfb/SDL_DirectFB_mouse.c +++ b/src/video/directfb/SDL_DirectFB_mouse.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" diff --git a/src/video/directfb/SDL_DirectFB_opengl.c b/src/video/directfb/SDL_DirectFB_opengl.c index 4ec2ff272..d459a42e4 100644 --- a/src/video/directfb/SDL_DirectFB_opengl.c +++ b/src/video/directfb/SDL_DirectFB_opengl.c @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL #include "SDL_DirectFB_opengl.h" #include "SDL_DirectFB_window.h" @@ -33,7 +33,7 @@ #include "SDL_loadso.h" #endif -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL struct SDL_GLDriverData { diff --git a/src/video/directfb/SDL_DirectFB_opengl.h b/src/video/directfb/SDL_DirectFB_opengl.h index 2436bf419..49d0caf97 100644 --- a/src/video/directfb/SDL_DirectFB_opengl.h +++ b/src/video/directfb/SDL_DirectFB_opengl.h @@ -25,7 +25,7 @@ #include "SDL_DirectFB_video.h" -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL #include "SDL_opengl.h" diff --git a/src/video/directfb/SDL_DirectFB_render.c b/src/video/directfb/SDL_DirectFB_render.c index 40f0e1a0c..cdcb0bdf9 100644 --- a/src/video/directfb/SDL_DirectFB_render.c +++ b/src/video/directfb/SDL_DirectFB_render.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_window.h" #include "SDL_DirectFB_modes.h" diff --git a/src/video/directfb/SDL_DirectFB_shape.c b/src/video/directfb/SDL_DirectFB_shape.c index 9fd976bae..79b8c69be 100644 --- a/src/video/directfb/SDL_DirectFB_shape.c +++ b/src/video/directfb/SDL_DirectFB_shape.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_shape.h" diff --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c index 529273248..04d1c2a28 100644 --- a/src/video/directfb/SDL_DirectFB_video.c +++ b/src/video/directfb/SDL_DirectFB_video.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB /* * #include "SDL_DirectFB_keyboard.h" @@ -118,7 +118,7 @@ static SDL_VideoDevice *DirectFB_CreateDevice(void) /* !!! FIXME: implement SetWindowBordered */ -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL device->GL_LoadLibrary = DirectFB_GL_LoadLibrary; device->GL_GetProcAddress = DirectFB_GL_GetProcAddress; device->GL_MakeCurrent = DirectFB_GL_MakeCurrent; @@ -136,7 +136,7 @@ static SDL_VideoDevice *DirectFB_CreateDevice(void) device->shape_driver.SetWindowShape = DirectFB_SetWindowShape; device->shape_driver.ResizeWindowShape = DirectFB_ResizeWindowShape; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = DirectFB_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = DirectFB_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = DirectFB_Vulkan_GetInstanceExtensions; @@ -262,7 +262,7 @@ static int DirectFB_VideoInit(_THIS) DirectFB_InitModes(_this); -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_Initialize(_this); #endif @@ -290,7 +290,7 @@ static void DirectFB_VideoQuit(_THIS) SDL_DFB_RELEASE(devdata->events); SDL_DFB_RELEASE(devdata->dfb); -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_Shutdown(_this); #endif diff --git a/src/video/directfb/SDL_DirectFB_vulkan.c b/src/video/directfb/SDL_DirectFB_vulkan.c index c29ec8be9..4d9795df5 100644 --- a/src/video/directfb/SDL_DirectFB_vulkan.c +++ b/src/video/directfb/SDL_DirectFB_vulkan.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_DIRECTFB +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_DIRECTFB) #include "SDL_DirectFB_window.h" diff --git a/src/video/directfb/SDL_DirectFB_vulkan.h b/src/video/directfb/SDL_DirectFB_vulkan.h index 4612c0d07..57a990543 100644 --- a/src/video/directfb/SDL_DirectFB_vulkan.h +++ b/src/video/directfb/SDL_DirectFB_vulkan.h @@ -27,7 +27,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_DIRECTFB +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_DIRECTFB) int DirectFB_Vulkan_LoadLibrary(_THIS, const char *path); void DirectFB_Vulkan_UnloadLibrary(_THIS); diff --git a/src/video/directfb/SDL_DirectFB_window.c b/src/video/directfb/SDL_DirectFB_window.c index 91be03b23..49264a803 100644 --- a/src/video/directfb/SDL_DirectFB_window.c +++ b/src/video/directfb/SDL_DirectFB_window.c @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_modes.h" #include "SDL_DirectFB_window.h" #include "SDL_DirectFB_shape.h" -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL #include "SDL_DirectFB_opengl.h" #endif @@ -402,7 +402,7 @@ void DirectFB_DestroyWindow(_THIS, SDL_Window * window) SDL_DFB_CHECK(windata->dfbwin->UngrabPointer(windata->dfbwin)); SDL_DFB_CHECK(windata->dfbwin->UngrabKeyboard(windata->dfbwin)); -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_DestroyWindowContexts(_this, window); #endif @@ -495,7 +495,7 @@ void DirectFB_AdjustWindowSurface(SDL_Window * window) } if (adjust) { -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_FreeWindowContexts(SDL_GetVideoDevice(), window); #endif @@ -524,7 +524,7 @@ void DirectFB_AdjustWindowSurface(SDL_Window * window) #endif DirectFB_WM_RedrawLayout(SDL_GetVideoDevice(), window); -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window); #endif } diff --git a/src/video/dummy/SDL_nullevents.c b/src/video/dummy/SDL_nullevents.c index 10712a81a..545cc5435 100644 --- a/src/video/dummy/SDL_nullevents.c +++ b/src/video/dummy/SDL_nullevents.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DUMMY +#ifdef SDL_VIDEO_DRIVER_DUMMY /* Being a null driver, there's no event stream. We just define stubs for most of the API. */ diff --git a/src/video/dummy/SDL_nullframebuffer.c b/src/video/dummy/SDL_nullframebuffer.c index 341957eca..57a78219d 100644 --- a/src/video/dummy/SDL_nullframebuffer.c +++ b/src/video/dummy/SDL_nullframebuffer.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DUMMY +#ifdef SDL_VIDEO_DRIVER_DUMMY #include "../SDL_sysvideo.h" #include "SDL_nullframebuffer_c.h" diff --git a/src/video/dummy/SDL_nullvideo.c b/src/video/dummy/SDL_nullvideo.c index ff073a34c..36a795bc7 100644 --- a/src/video/dummy/SDL_nullvideo.c +++ b/src/video/dummy/SDL_nullvideo.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DUMMY +#ifdef SDL_VIDEO_DRIVER_DUMMY /* Dummy SDL video driver implementation; this is just enough to make an * SDL-based application THINK it's got a working video driver, for @@ -55,7 +55,7 @@ static int DUMMY_VideoInit(_THIS); static void DUMMY_VideoQuit(_THIS); -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV static int evdev = 0; static void DUMMY_EVDEV_Poll(_THIS); #endif @@ -69,7 +69,7 @@ static int DUMMY_Available(void) if (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0) { return 1; } -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV if (SDL_strcmp(envr, DUMMYVID_DRIVER_EVDEV_NAME) == 0) { evdev = 1; return 1; @@ -104,7 +104,7 @@ static SDL_VideoDevice *DUMMY_CreateDevice(void) device->VideoInit = DUMMY_VideoInit; device->VideoQuit = DUMMY_VideoQuit; device->PumpEvents = DUMMY_PumpEvents; -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV if (evdev) { device->PumpEvents = DUMMY_EVDEV_Poll; } @@ -123,7 +123,7 @@ VideoBootStrap DUMMY_bootstrap = { DUMMY_CreateDevice }; -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV VideoBootStrap DUMMY_evdev_bootstrap = { DUMMYVID_DRIVER_EVDEV_NAME, "SDL dummy video driver with evdev", DUMMY_CreateDevice @@ -155,7 +155,7 @@ int DUMMY_VideoInit(_THIS) SDL_AddDisplayMode(&_this->displays[0], &mode); -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV SDL_EVDEV_Init(); #endif @@ -165,7 +165,7 @@ int DUMMY_VideoInit(_THIS) void DUMMY_VideoQuit(_THIS) { -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV SDL_EVDEV_Quit(); #endif } diff --git a/src/video/emscripten/SDL_emscriptenevents.c b/src/video/emscripten/SDL_emscriptenevents.c index f2bae8bbe..62a9d206a 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include #include diff --git a/src/video/emscripten/SDL_emscriptenframebuffer.c b/src/video/emscripten/SDL_emscriptenframebuffer.c index ba445fb07..e489e06a4 100644 --- a/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include "SDL_emscriptenvideo.h" #include "SDL_emscriptenframebuffer.h" diff --git a/src/video/emscripten/SDL_emscriptenmouse.c b/src/video/emscripten/SDL_emscriptenmouse.c index 0ffc4adbf..f40e473a0 100644 --- a/src/video/emscripten/SDL_emscriptenmouse.c +++ b/src/video/emscripten/SDL_emscriptenmouse.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include #include diff --git a/src/video/emscripten/SDL_emscriptenopengles.c b/src/video/emscripten/SDL_emscriptenopengles.c index aea127f02..044445d78 100644 --- a/src/video/emscripten/SDL_emscriptenopengles.c +++ b/src/video/emscripten/SDL_emscriptenopengles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_EMSCRIPTEN) && defined(SDL_VIDEO_OPENGL_EGL) #include #include diff --git a/src/video/emscripten/SDL_emscriptenopengles.h b/src/video/emscripten/SDL_emscriptenopengles.h index 869982df1..b030132cf 100644 --- a/src/video/emscripten/SDL_emscriptenopengles.h +++ b/src/video/emscripten/SDL_emscriptenopengles.h @@ -23,7 +23,7 @@ #ifndef SDL_emscriptenopengles_h_ #define SDL_emscriptenopengles_h_ -#if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_EMSCRIPTEN) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c index d4033d2b8..00b6fd66a 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.c +++ b/src/video/emscripten/SDL_emscriptenvideo.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include "SDL_video.h" #include "SDL_mouse.h" @@ -106,7 +106,7 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void) device->UpdateWindowFramebuffer = Emscripten_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = Emscripten_DestroyWindowFramebuffer; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Emscripten_GLES_LoadLibrary; device->GL_GetProcAddress = Emscripten_GLES_GetProcAddress; device->GL_UnloadLibrary = Emscripten_GLES_UnloadLibrary; @@ -247,7 +247,7 @@ static int Emscripten_CreateWindow(_THIS, SDL_Window *window) } } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { if (!_this->egl_data) { if (SDL_GL_LoadLibrary(NULL) < 0) { @@ -314,7 +314,7 @@ static void Emscripten_DestroyWindow(_THIS, SDL_Window *window) data = (SDL_WindowData *)window->driverdata; Emscripten_UnregisterEventHandlers(data); -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; diff --git a/src/video/emscripten/SDL_emscriptenvideo.h b/src/video/emscripten/SDL_emscriptenvideo.h index dd97dcfbb..557bf907f 100644 --- a/src/video/emscripten/SDL_emscriptenvideo.h +++ b/src/video/emscripten/SDL_emscriptenvideo.h @@ -28,13 +28,13 @@ #include #include -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include #endif typedef struct SDL_WindowData { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif SDL_Window *window; diff --git a/src/video/haiku/SDL_BApp.h b/src/video/haiku/SDL_BApp.h index 036808167..867465f42 100644 --- a/src/video/haiku/SDL_BApp.h +++ b/src/video/haiku/SDL_BApp.h @@ -24,7 +24,7 @@ #include #include #include -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include #endif @@ -85,7 +85,7 @@ class SDL_BLooper : public BLooper public: SDL_BLooper(const char* name) : BLooper(name) { -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _current_context = NULL; #endif } @@ -199,7 +199,7 @@ class SDL_BLooper : public BLooper return _window_map[winID]; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *GetCurrentContext() { return _current_context; @@ -419,7 +419,7 @@ class SDL_BLooper : public BLooper /* Members */ std::vector _window_map; /* Keeps track of SDL_Windows by index-id */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *_current_context; #endif }; diff --git a/src/video/haiku/SDL_BWin.h b/src/video/haiku/SDL_BWin.h index ed1b96147..819ebfd99 100644 --- a/src/video/haiku/SDL_BWin.h +++ b/src/video/haiku/SDL_BWin.h @@ -39,7 +39,7 @@ extern "C" { #include #include #include -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include #endif #include "SDL_events.h" @@ -99,7 +99,7 @@ class SDL_BWin : public BWindow _cur_view = NULL; _SDL_View = NULL; -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _SDL_GLView = NULL; _gl_type = 0; #endif @@ -123,7 +123,7 @@ class SDL_BWin : public BWindow _SDL_View = NULL; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL if (_SDL_GLView) { if (SDL_Looper->GetCurrentContext() == _SDL_GLView) SDL_Looper->SetCurrentContext(NULL); @@ -189,7 +189,7 @@ class SDL_BWin : public BWindow } /* * * * * OpenGL functionality * * * * */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *CreateGLView(Uint32 gl_flags) { Lock(); @@ -476,7 +476,7 @@ class SDL_BWin : public BWindow BBitmap *GetBitmap() { return _bitmap; } BView *GetCurView() { return _cur_view; } SDL_BView *GetView() { return _SDL_View; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *GetGLView() { return _SDL_GLView; @@ -712,7 +712,7 @@ class SDL_BWin : public BWindow BView *_cur_view; SDL_BView *_SDL_View; -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *_SDL_GLView; Uint32 _gl_type; #endif diff --git a/src/video/haiku/SDL_bclipboard.cc b/src/video/haiku/SDL_bclipboard.cc index 6166d291e..b2ec8b8aa 100644 --- a/src/video/haiku/SDL_bclipboard.cc +++ b/src/video/haiku/SDL_bclipboard.cc @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU /* BWindow based clipboard implementation */ diff --git a/src/video/haiku/SDL_bevents.cc b/src/video/haiku/SDL_bevents.cc index f0b7e2d28..280142395 100644 --- a/src/video/haiku/SDL_bevents.cc +++ b/src/video/haiku/SDL_bevents.cc @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "SDL_bevents.h" diff --git a/src/video/haiku/SDL_bframebuffer.cc b/src/video/haiku/SDL_bframebuffer.cc index 9c4be2846..5d77b0d12 100644 --- a/src/video/haiku/SDL_bframebuffer.cc +++ b/src/video/haiku/SDL_bframebuffer.cc @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "SDL_bframebuffer.h" diff --git a/src/video/haiku/SDL_bkeyboard.cc b/src/video/haiku/SDL_bkeyboard.cc index 84ac3c7d1..70b14f523 100644 --- a/src/video/haiku/SDL_bkeyboard.cc +++ b/src/video/haiku/SDL_bkeyboard.cc @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include #include diff --git a/src/video/haiku/SDL_bmessagebox.cc b/src/video/haiku/SDL_bmessagebox.cc index 620be9603..e0501ee20 100644 --- a/src/video/haiku/SDL_bmessagebox.cc +++ b/src/video/haiku/SDL_bmessagebox.cc @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "SDL_messagebox.h" diff --git a/src/video/haiku/SDL_bmessagebox.h b/src/video/haiku/SDL_bmessagebox.h index 9c4243f42..ff9d8ab8d 100644 --- a/src/video/haiku/SDL_bmessagebox.h +++ b/src/video/haiku/SDL_bmessagebox.h @@ -25,7 +25,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #ifdef __cplusplus extern "C" { diff --git a/src/video/haiku/SDL_bmodes.cc b/src/video/haiku/SDL_bmodes.cc index eb8f15312..a0243108a 100644 --- a/src/video/haiku/SDL_bmodes.cc +++ b/src/video/haiku/SDL_bmodes.cc @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include #include #include "SDL_bmodes.h" #include "SDL_BWin.h" -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include "SDL_bopengl.h" #endif @@ -288,7 +288,7 @@ int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode free(bmode_list); /* This should not be SDL_free() */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL /* FIXME: Is there some way to reboot the OpenGL context? This doesn't help */ // HAIKU_GL_RebootContexts(_this); diff --git a/src/video/haiku/SDL_bopengl.cc b/src/video/haiku/SDL_bopengl.cc index 3949e4bbd..3dc58d744 100644 --- a/src/video/haiku/SDL_bopengl.cc +++ b/src/video/haiku/SDL_bopengl.cc @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_DRIVER_HAIKU) && defined(SDL_VIDEO_OPENGL) #include "SDL_bopengl.h" diff --git a/src/video/haiku/SDL_bopengl.h b/src/video/haiku/SDL_bopengl.h index 0085a1e5b..582225d60 100644 --- a/src/video/haiku/SDL_bopengl.h +++ b/src/video/haiku/SDL_bopengl.h @@ -22,7 +22,7 @@ #ifndef SDL_BOPENGL_H #define SDL_BOPENGL_H -#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_DRIVER_HAIKU) && defined(SDL_VIDEO_OPENGL) #ifdef __cplusplus extern "C" { diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc index 7e26c1ac0..cd13d4b51 100644 --- a/src/video/haiku/SDL_bvideo.cc +++ b/src/video/haiku/SDL_bvideo.cc @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" #include "../../main/haiku/SDL_BApp.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "SDL_BWin.h" #include @@ -104,7 +104,7 @@ static SDL_VideoDevice * HAIKU_CreateDevice(void) device->shape_driver.SetWindowShape = NULL; device->shape_driver.ResizeWindowShape = NULL; -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL device->GL_LoadLibrary = HAIKU_GL_LoadLibrary; device->GL_GetProcAddress = HAIKU_GL_GetProcAddress; device->GL_UnloadLibrary = HAIKU_GL_UnloadLibrary; @@ -281,7 +281,7 @@ int HAIKU_VideoInit(_THIS) HAIKU_MouseInit(_this); -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL /* testgl application doesn't load library, just tries to load symbols */ /* is it correct? if so we have to load library here */ HAIKU_GL_LoadLibrary(_this, NULL); diff --git a/src/video/haiku/SDL_bwindow.cc b/src/video/haiku/SDL_bwindow.cc index db21719b5..50ab873b0 100644 --- a/src/video/haiku/SDL_bwindow.cc +++ b/src/video/haiku/SDL_bwindow.cc @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "../SDL_sysvideo.h" #include "SDL_BWin.h" diff --git a/src/video/kmsdrm/SDL_kmsdrmdyn.c b/src/video/kmsdrm/SDL_kmsdrmdyn.c index 14460dc3d..5f0fbab6e 100644 --- a/src/video/kmsdrm/SDL_kmsdrmdyn.c +++ b/src/video/kmsdrm/SDL_kmsdrmdyn.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #define DEBUG_DYNAMIC_KMSDRM 0 diff --git a/src/video/kmsdrm/SDL_kmsdrmevents.c b/src/video/kmsdrm/SDL_kmsdrmevents.c index 8a97c8798..655d4a148 100644 --- a/src/video/kmsdrm/SDL_kmsdrmevents.c +++ b/src/video/kmsdrm/SDL_kmsdrmevents.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #include "SDL_kmsdrmvideo.h" #include "SDL_kmsdrmevents.h" diff --git a/src/video/kmsdrm/SDL_kmsdrmmouse.c b/src/video/kmsdrm/SDL_kmsdrmmouse.c index b139abe46..78e171046 100644 --- a/src/video/kmsdrm/SDL_kmsdrmmouse.c +++ b/src/video/kmsdrm/SDL_kmsdrmmouse.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #include "SDL_kmsdrmvideo.h" #include "SDL_kmsdrmmouse.h" diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c index ca31b4a03..bb092708a 100644 --- a/src/video/kmsdrm/SDL_kmsdrmopengles.c +++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #include "SDL_log.h" #include "SDL_timer.h" @@ -41,7 +41,7 @@ void KMSDRM_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor) { /* if SDL was _also_ built with the Raspberry Pi driver (so we're definitely a Pi device), default to GLES2. */ -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI *mask = SDL_GL_CONTEXT_PROFILE_ES; *major = 2; *minor = 0; diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.h b/src/video/kmsdrm/SDL_kmsdrmopengles.h index 0f1ef8740..13a4da408 100644 --- a/src/video/kmsdrm/SDL_kmsdrmopengles.h +++ b/src/video/kmsdrm/SDL_kmsdrmopengles.h @@ -23,7 +23,7 @@ #ifndef SDL_kmsdrmopengles_h_ #define SDL_kmsdrmopengles_h_ -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index 006798042..c27e4f9ee 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM /* SDL internals */ #include "../SDL_sysvideo.h" @@ -290,7 +290,7 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void) device->GL_DeleteContext = KMSDRM_GLES_DeleteContext; device->GL_DefaultProfileConfig = KMSDRM_GLES_DefaultProfileConfig; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = KMSDRM_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = KMSDRM_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = KMSDRM_Vulkan_GetInstanceExtensions; diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/src/video/kmsdrm/SDL_kmsdrmvulkan.c index 31a3061cb..477abef5c 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvulkan.c +++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.c @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_KMSDRM +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_KMSDRM) #include "SDL_kmsdrmvideo.h" #include "SDL_kmsdrmdyn.h" diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.h b/src/video/kmsdrm/SDL_kmsdrmvulkan.h index 76e865ad0..ddefc3ca8 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvulkan.h +++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.h @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_KMSDRM +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_KMSDRM) int KMSDRM_Vulkan_LoadLibrary(_THIS, const char *path); void KMSDRM_Vulkan_UnloadLibrary(_THIS); diff --git a/src/video/nacl/SDL_naclevents.c b/src/video/nacl/SDL_naclevents.c index ce03e525e..5aab9f880 100644 --- a/src/video/nacl/SDL_naclevents.c +++ b/src/video/nacl/SDL_naclevents.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL #include "SDL.h" #include "../../events/SDL_events_c.h" diff --git a/src/video/nacl/SDL_naclglue.c b/src/video/nacl/SDL_naclglue.c index 1146c6883..773c5a008 100644 --- a/src/video/nacl/SDL_naclglue.c +++ b/src/video/nacl/SDL_naclglue.c @@ -20,5 +20,5 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL #endif /* SDL_VIDEO_DRIVER_NACL */ diff --git a/src/video/nacl/SDL_naclopengles.c b/src/video/nacl/SDL_naclopengles.c index 5889839f3..f11cf7697 100644 --- a/src/video/nacl/SDL_naclopengles.c +++ b/src/video/nacl/SDL_naclopengles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL /* NaCl SDL video GLES 2 driver implementation */ diff --git a/src/video/nacl/SDL_naclvideo.c b/src/video/nacl/SDL_naclvideo.c index ef8903807..0dc9fee67 100644 --- a/src/video/nacl/SDL_naclvideo.c +++ b/src/video/nacl/SDL_naclvideo.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_instance.h" diff --git a/src/video/nacl/SDL_naclwindow.c b/src/video/nacl/SDL_naclwindow.c index 3c2222051..094afebe7 100644 --- a/src/video/nacl/SDL_naclwindow.c +++ b/src/video/nacl/SDL_naclwindow.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL #include "../SDL_sysvideo.h" diff --git a/src/video/ngage/SDL_ngageevents.cpp b/src/video/ngage/SDL_ngageevents.cpp index d5b8b3abf..d2520db33 100644 --- a/src/video/ngage/SDL_ngageevents.cpp +++ b/src/video/ngage/SDL_ngageevents.cpp @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE /* Being a ngage driver, there's no event stream. We just define stubs for most of the API. */ diff --git a/src/video/ngage/SDL_ngageframebuffer.cpp b/src/video/ngage/SDL_ngageframebuffer.cpp index af170ea73..d3c898d09 100644 --- a/src/video/ngage/SDL_ngageframebuffer.cpp +++ b/src/video/ngage/SDL_ngageframebuffer.cpp @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE #include diff --git a/src/video/ngage/SDL_ngagevideo.cpp b/src/video/ngage/SDL_ngagevideo.cpp index b3d42b9e2..672f2f5c5 100644 --- a/src/video/ngage/SDL_ngagevideo.cpp +++ b/src/video/ngage/SDL_ngagevideo.cpp @@ -25,7 +25,7 @@ #endif #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE #ifdef __cplusplus extern "C" { diff --git a/src/video/ngage/SDL_ngagewindow.cpp b/src/video/ngage/SDL_ngagewindow.cpp index 1ff57a8da..30c795f9f 100644 --- a/src/video/ngage/SDL_ngagewindow.cpp +++ b/src/video/ngage/SDL_ngagewindow.cpp @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE #include "../SDL_sysvideo.h" diff --git a/src/video/offscreen/SDL_offscreenevents.c b/src/video/offscreen/SDL_offscreenevents.c index 57e12b473..6526a407f 100644 --- a/src/video/offscreen/SDL_offscreenevents.c +++ b/src/video/offscreen/SDL_offscreenevents.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN /* Being a offscreen driver, there's no event stream. We just define stubs for most of the API. */ diff --git a/src/video/offscreen/SDL_offscreenframebuffer.c b/src/video/offscreen/SDL_offscreenframebuffer.c index 6fa04d6e8..650a8842d 100644 --- a/src/video/offscreen/SDL_offscreenframebuffer.c +++ b/src/video/offscreen/SDL_offscreenframebuffer.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN #include "../SDL_sysvideo.h" #include "SDL_offscreenframebuffer_c.h" diff --git a/src/video/offscreen/SDL_offscreenopengles.c b/src/video/offscreen/SDL_offscreenopengles.c index 818569677..2f9ab3a05 100644 --- a/src/video/offscreen/SDL_offscreenopengles.c +++ b/src/video/offscreen/SDL_offscreenopengles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_OFFSCREEN) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_offscreenopengles.h" #include "SDL_offscreenvideo.h" diff --git a/src/video/offscreen/SDL_offscreenopengles.h b/src/video/offscreen/SDL_offscreenopengles.h index 12a068afc..85708f45c 100644 --- a/src/video/offscreen/SDL_offscreenopengles.h +++ b/src/video/offscreen/SDL_offscreenopengles.h @@ -23,7 +23,7 @@ #ifndef _SDL_offscreenopengles_h #define _SDL_offscreenopengles_h -#if SDL_VIDEO_DRIVER_OFFSCREEN && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_OFFSCREEN) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/src/video/offscreen/SDL_offscreenvideo.c b/src/video/offscreen/SDL_offscreenvideo.c index 23c4bb5ee..052c2c8d0 100644 --- a/src/video/offscreen/SDL_offscreenvideo.c +++ b/src/video/offscreen/SDL_offscreenvideo.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN /* Offscreen video driver is similar to dummy driver, however its purpose * is enabling applications to use some of the SDL video functionality @@ -73,7 +73,7 @@ static SDL_VideoDevice *OFFSCREEN_CreateDevice(void) device->DestroyWindowFramebuffer = SDL_OFFSCREEN_DestroyWindowFramebuffer; device->free = OFFSCREEN_DeleteDevice; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* GL context */ device->GL_SwapWindow = OFFSCREEN_GLES_SwapWindow; device->GL_MakeCurrent = OFFSCREEN_GLES_MakeCurrent; diff --git a/src/video/offscreen/SDL_offscreenwindow.c b/src/video/offscreen/SDL_offscreenwindow.c index 934616166..bc2d9a11b 100644 --- a/src/video/offscreen/SDL_offscreenwindow.c +++ b/src/video/offscreen/SDL_offscreenwindow.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" @@ -47,7 +47,7 @@ int OFFSCREEN_CreateWindow(_THIS, SDL_Window *window) offscreen_window->sdl_window = window; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { if (!_this->egl_data) { @@ -73,7 +73,7 @@ void OFFSCREEN_DestroyWindow(_THIS, SDL_Window *window) OFFSCREEN_Window *offscreen_window = window->driverdata; if (offscreen_window) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL SDL_EGL_DestroySurface(_this, offscreen_window->egl_surface); #endif SDL_free(offscreen_window); diff --git a/src/video/offscreen/SDL_offscreenwindow.h b/src/video/offscreen/SDL_offscreenwindow.h index 692f5d5d6..6786d1a71 100644 --- a/src/video/offscreen/SDL_offscreenwindow.h +++ b/src/video/offscreen/SDL_offscreenwindow.h @@ -28,7 +28,7 @@ typedef struct { SDL_Window *sdl_window; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif diff --git a/src/video/os2/SDL_os2messagebox.c b/src/video/os2/SDL_os2messagebox.c index 075ae8a1d..a7b766bdc 100644 --- a/src/video/os2/SDL_os2messagebox.c +++ b/src/video/os2/SDL_os2messagebox.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 /* Display a OS/2 message box */ @@ -284,7 +284,7 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) } pcDlgData += pDlgItem->cchText; - pDlgItem->flStyle = WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS | + pDlgItem->flStyle = WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS | FS_DLGBORDER | WS_SAVEBITS; pDlgItem->x = 100; pDlgItem->y = 100; diff --git a/src/video/os2/SDL_os2messagebox.h b/src/video/os2/SDL_os2messagebox.h index 92b94d98c..a6ccb8c9a 100644 --- a/src/video/os2/SDL_os2messagebox.h +++ b/src/video/os2/SDL_os2messagebox.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 extern int OS2_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/src/video/os2/SDL_os2mouse.c b/src/video/os2/SDL_os2mouse.c index 18468801d..9b6cc2e45 100644 --- a/src/video/os2/SDL_os2mouse.c +++ b/src/video/os2/SDL_os2mouse.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 #include "SDL_os2video.h" #include "../../events/SDL_mouse_c.h" diff --git a/src/video/os2/SDL_os2util.c b/src/video/os2/SDL_os2util.c index 86541c5cf..874016f3c 100644 --- a/src/video/os2/SDL_os2util.c +++ b/src/video/os2/SDL_os2util.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 #include "SDL_os2util.h" diff --git a/src/video/os2/SDL_os2video.c b/src/video/os2/SDL_os2video.c index 7c8462005..ca104ebdb 100644 --- a/src/video/os2/SDL_os2video.c +++ b/src/video/os2/SDL_os2video.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 #include "SDL_video.h" #include "SDL_mouse.h" diff --git a/src/video/pandora/SDL_pandora.c b/src/video/pandora/SDL_pandora.c index 5b1498aa1..9e7aae514 100644 --- a/src/video/pandora/SDL_pandora.c +++ b/src/video/pandora/SDL_pandora.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PANDORA +#ifdef SDL_VIDEO_DRIVER_PANDORA /* SDL internals */ #include "../SDL_sysvideo.h" diff --git a/src/video/pandora/SDL_pandora_events.c b/src/video/pandora/SDL_pandora_events.c index 906c75800..d70b23c5d 100644 --- a/src/video/pandora/SDL_pandora_events.c +++ b/src/video/pandora/SDL_pandora_events.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PANDORA +#ifdef SDL_VIDEO_DRIVER_PANDORA /* Being a null driver, there's no event stream. We just define stubs for most of the API. */ diff --git a/src/video/ps2/SDL_ps2video.c b/src/video/ps2/SDL_ps2video.c index 9edca12bb..36d551979 100644 --- a/src/video/ps2/SDL_ps2video.c +++ b/src/video/ps2/SDL_ps2video.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PS2 +#ifdef SDL_VIDEO_DRIVER_PS2 /* PS2 SDL video driver implementation; this is just enough to make an * SDL-based application THINK it's got a working video driver, for diff --git a/src/video/psp/SDL_pspevents.c b/src/video/psp/SDL_pspevents.c index ebea736df..321e102c0 100644 --- a/src/video/psp/SDL_pspevents.c +++ b/src/video/psp/SDL_pspevents.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP /* Being a null driver, there's no event stream. We just define stubs for most of the API. */ diff --git a/src/video/psp/SDL_pspgl.c b/src/video/psp/SDL_pspgl.c index a00e638e9..064526b32 100644 --- a/src/video/psp/SDL_pspgl.c +++ b/src/video/psp/SDL_pspgl.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP #include #include diff --git a/src/video/psp/SDL_pspmouse.c b/src/video/psp/SDL_pspmouse.c index 774649adb..6f70fd027 100644 --- a/src/video/psp/SDL_pspmouse.c +++ b/src/video/psp/SDL_pspmouse.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP #include diff --git a/src/video/psp/SDL_pspvideo.c b/src/video/psp/SDL_pspvideo.c index 110ca7675..a7212bea6 100644 --- a/src/video/psp/SDL_pspvideo.c +++ b/src/video/psp/SDL_pspvideo.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP /* SDL internals */ #include "../SDL_sysvideo.h" diff --git a/src/video/raspberry/SDL_rpievents.c b/src/video/raspberry/SDL_rpievents.c index 9f2fccc0e..f88baeb69 100644 --- a/src/video/raspberry/SDL_rpievents.c +++ b/src/video/raspberry/SDL_rpievents.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI #include "../../events/SDL_events_c.h" #include "../../events/SDL_keyboard_c.h" diff --git a/src/video/raspberry/SDL_rpimouse.c b/src/video/raspberry/SDL_rpimouse.c index b14235d0d..ff2e86bd6 100644 --- a/src/video/raspberry/SDL_rpimouse.c +++ b/src/video/raspberry/SDL_rpimouse.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI #include "SDL_surface.h" #include "SDL_hints.h" diff --git a/src/video/raspberry/SDL_rpiopengles.c b/src/video/raspberry/SDL_rpiopengles.c index bce27e2c4..46b9933bd 100644 --- a/src/video/raspberry/SDL_rpiopengles.c +++ b/src/video/raspberry/SDL_rpiopengles.c @@ -22,7 +22,7 @@ #include "SDL_hints.h" -#if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_RPI) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_rpivideo.h" #include "SDL_rpiopengles.h" diff --git a/src/video/raspberry/SDL_rpiopengles.h b/src/video/raspberry/SDL_rpiopengles.h index cfe7a9473..6af2bed1d 100644 --- a/src/video/raspberry/SDL_rpiopengles.h +++ b/src/video/raspberry/SDL_rpiopengles.h @@ -23,7 +23,7 @@ #ifndef SDL_rpiopengles_h_ #define SDL_rpiopengles_h_ -#if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_RPI) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/src/video/raspberry/SDL_rpivideo.c b/src/video/raspberry/SDL_rpivideo.c index a87570334..1bdb3c9d3 100644 --- a/src/video/raspberry/SDL_rpivideo.c +++ b/src/video/raspberry/SDL_rpivideo.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI /* References * http://elinux.org/RPi_VideoCore_APIs @@ -350,7 +350,7 @@ void RPI_DestroyWindow(_THIS, SDL_Window *window) SDL_DestroyMutex(data->vsync_cond_mutex); } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } diff --git a/src/video/raspberry/SDL_rpivideo.h b/src/video/raspberry/SDL_rpivideo.h index a0e9d21a6..016914945 100644 --- a/src/video/raspberry/SDL_rpivideo.h +++ b/src/video/raspberry/SDL_rpivideo.h @@ -43,7 +43,7 @@ typedef struct SDL_DisplayData typedef struct SDL_WindowData { EGL_DISPMANX_WINDOW_T dispman_window; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif diff --git a/src/video/riscos/SDL_riscosevents.c b/src/video/riscos/SDL_riscosevents.c index 77b3ba94d..dbf59a8b2 100644 --- a/src/video/riscos/SDL_riscosevents.c +++ b/src/video/riscos/SDL_riscosevents.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "../../events/SDL_events_c.h" @@ -152,7 +152,7 @@ int RISCOS_InitEvents(_THIS) SDL_ToggleModState(KMOD_NUM, (status & (1 << 2)) ? SDL_FALSE : SDL_TRUE); SDL_ToggleModState(KMOD_CAPS, (status & (1 << 4)) ? SDL_FALSE : SDL_TRUE); SDL_ToggleModState(KMOD_SCROLL, (status & (1 << 1)) ? SDL_TRUE : SDL_FALSE); - + _kernel_swi(OS_Mouse, ®s, ®s); driverdata->last_mouse_buttons = regs.r[2]; diff --git a/src/video/riscos/SDL_riscosframebuffer.c b/src/video/riscos/SDL_riscosframebuffer.c index 64f2ce639..9429e2e85 100644 --- a/src/video/riscos/SDL_riscosframebuffer.c +++ b/src/video/riscos/SDL_riscosframebuffer.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "../SDL_sysvideo.h" #include "SDL_riscosframebuffer_c.h" diff --git a/src/video/riscos/SDL_riscosmessagebox.c b/src/video/riscos/SDL_riscosmessagebox.c index c2fe81b97..ca71a30e1 100644 --- a/src/video/riscos/SDL_riscosmessagebox.c +++ b/src/video/riscos/SDL_riscosmessagebox.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "SDL_messagebox.h" #include "SDL_riscosmessagebox.h" diff --git a/src/video/riscos/SDL_riscosmessagebox.h b/src/video/riscos/SDL_riscosmessagebox.h index 4fbf6afa7..e8323a9ec 100644 --- a/src/video/riscos/SDL_riscosmessagebox.h +++ b/src/video/riscos/SDL_riscosmessagebox.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS extern int RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/src/video/riscos/SDL_riscosmodes.c b/src/video/riscos/SDL_riscosmodes.c index 2a6d6b3f6..eeb460648 100644 --- a/src/video/riscos/SDL_riscosmodes.c +++ b/src/video/riscos/SDL_riscosmodes.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "../SDL_sysvideo.h" #include "../../events/SDL_mouse_c.h" diff --git a/src/video/riscos/SDL_riscosmouse.c b/src/video/riscos/SDL_riscosmouse.c index e4c42222b..dd901899e 100644 --- a/src/video/riscos/SDL_riscosmouse.c +++ b/src/video/riscos/SDL_riscosmouse.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "../../events/SDL_mouse_c.h" diff --git a/src/video/riscos/SDL_riscosvideo.c b/src/video/riscos/SDL_riscosvideo.c index 29a818f64..9043a8e32 100644 --- a/src/video/riscos/SDL_riscosvideo.c +++ b/src/video/riscos/SDL_riscosvideo.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "SDL_video.h" #include "SDL_mouse.h" diff --git a/src/video/riscos/SDL_riscoswindow.c b/src/video/riscos/SDL_riscoswindow.c index 6a1b89421..8af3550ff 100644 --- a/src/video/riscos/SDL_riscoswindow.c +++ b/src/video/riscos/SDL_riscoswindow.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "SDL_version.h" #include "SDL_syswm.h" diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index 1e27200e0..e700ae609 100644 --- a/src/video/uikit/SDL_uikitappdelegate.m +++ b/src/video/uikit/SDL_uikitappdelegate.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "../SDL_sysvideo.h" #include "SDL_hints.h" @@ -408,7 +408,7 @@ static UIImage *SDL_LoadLaunchImageNamed(NSString *name, int screenh) { NSBundle *bundle = [NSBundle mainBundle]; -#if SDL_IPHONE_LAUNCHSCREEN +#ifdef SDL_IPHONE_LAUNCHSCREEN /* The normal launch screen is displayed until didFinishLaunching returns, * but SDL_main is called after that happens and there may be a noticeable * delay between the start of SDL_main and when the first real frame is diff --git a/src/video/uikit/SDL_uikitclipboard.m b/src/video/uikit/SDL_uikitclipboard.m index da475f308..824ecea3a 100644 --- a/src/video/uikit/SDL_uikitclipboard.m +++ b/src/video/uikit/SDL_uikitclipboard.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_uikitvideo.h" #include "../../events/SDL_clipboardevents_c.h" diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m index 6789f5f71..fc5c65030 100644 --- a/src/video/uikit/SDL_uikitevents.m +++ b/src/video/uikit/SDL_uikitevents.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "../../events/SDL_events_c.h" @@ -146,7 +146,7 @@ void UIKit_PumpEvents(_THIS) } while(result == kCFRunLoopRunHandledSource); /* See the comment in the function definition. */ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) UIKit_GL_RestoreCurrentContext(); #endif } diff --git a/src/video/uikit/SDL_uikitmessagebox.h b/src/video/uikit/SDL_uikitmessagebox.h index c553c0459..96475b5a8 100644 --- a/src/video/uikit/SDL_uikitmessagebox.h +++ b/src/video/uikit/SDL_uikitmessagebox.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT extern SDL_bool UIKit_ShowingMessageBox(void); diff --git a/src/video/uikit/SDL_uikitmessagebox.m b/src/video/uikit/SDL_uikitmessagebox.m index 03e3f3803..e02ea4a94 100644 --- a/src/video/uikit/SDL_uikitmessagebox.m +++ b/src/video/uikit/SDL_uikitmessagebox.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL.h" #include "SDL_uikitvideo.h" diff --git a/src/video/uikit/SDL_uikitmetalview.h b/src/video/uikit/SDL_uikitmetalview.h index 3f9112368..cc93d7577 100644 --- a/src/video/uikit/SDL_uikitmetalview.h +++ b/src/video/uikit/SDL_uikitmetalview.h @@ -1,15 +1,15 @@ /* Simple DirectMedia Layer Copyright (C) 1997-2023 Sam Lantinga - + This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be @@ -32,7 +32,7 @@ #include "../SDL_sysvideo.h" #include "SDL_uikitwindow.h" -#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) +#if defined(SDL_VIDEO_DRIVER_UIKIT) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)) #import #import diff --git a/src/video/uikit/SDL_uikitmetalview.m b/src/video/uikit/SDL_uikitmetalview.m index 6bb43eaa5..3b21b4cad 100644 --- a/src/video/uikit/SDL_uikitmetalview.m +++ b/src/video/uikit/SDL_uikitmetalview.m @@ -28,7 +28,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) +#if defined(SDL_VIDEO_DRIVER_UIKIT) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)) #include "SDL_syswm.h" #include "../SDL_sysvideo.h" diff --git a/src/video/uikit/SDL_uikitmodes.m b/src/video/uikit/SDL_uikitmodes.m index e60badaec..0fe4ddfa4 100644 --- a/src/video/uikit/SDL_uikitmodes.m +++ b/src/video/uikit/SDL_uikitmodes.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_system.h" #include "SDL_uikitmodes.h" diff --git a/src/video/uikit/SDL_uikitopengles.h b/src/video/uikit/SDL_uikitopengles.h index 509c0c885..b75e634c0 100644 --- a/src/video/uikit/SDL_uikitopengles.h +++ b/src/video/uikit/SDL_uikitopengles.h @@ -21,7 +21,7 @@ #ifndef SDL_uikitopengles_ #define SDL_uikitopengles_ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) #include "../SDL_sysvideo.h" @@ -37,7 +37,7 @@ extern int UIKit_GL_LoadLibrary(_THIS, const char *path); extern void UIKit_GL_RestoreCurrentContext(void); -#endif // SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#endif // SDL_VIDEO_OPENGL_ES || defined(SDL_VIDEO_OPENGL_ES2) #endif /* SDL_uikitopengles_ */ diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index e0e7b5b38..31b38587d 100644 --- a/src/video/uikit/SDL_uikitopengles.m +++ b/src/video/uikit/SDL_uikitopengles.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2) +#if defined(SDL_VIDEO_DRIVER_UIKIT) && (defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2)) #include "SDL_uikitopengles.h" #import "SDL_uikitopenglview.h" @@ -114,7 +114,7 @@ int UIKit_GL_SwapWindow(_THIS, SDL_Window * window) @autoreleasepool { SDLEAGLContext *context = (__bridge SDLEAGLContext *) SDL_GL_GetCurrentContext(); -#if SDL_POWER_UIKIT +#ifdef SDL_POWER_UIKIT /* Check once a frame to see if we should turn off the battery monitor. */ SDL_UIKit_UpdateBatteryMonitoring(); #endif diff --git a/src/video/uikit/SDL_uikitopenglview.h b/src/video/uikit/SDL_uikitopenglview.h index 15f1770a4..102f01416 100644 --- a/src/video/uikit/SDL_uikitopenglview.h +++ b/src/video/uikit/SDL_uikitopenglview.h @@ -19,7 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) #import #import diff --git a/src/video/uikit/SDL_uikitopenglview.m b/src/video/uikit/SDL_uikitopenglview.m index 3e59f19bc..a43b46497 100644 --- a/src/video/uikit/SDL_uikitopenglview.m +++ b/src/video/uikit/SDL_uikitopenglview.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2) +#if defined(SDL_VIDEO_DRIVER_UIKIT) && (defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2)) #include #include diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 8b16c2399..d7d593932 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #import @@ -99,7 +99,7 @@ static SDL_VideoDevice *UIKit_CreateDevice(void) device->GetDisplayDPI = UIKit_GetDisplayDPI; device->GetWindowSizeInPixels = UIKit_GetWindowSizeInPixels; -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; device->HideScreenKeyboard = UIKit_HideScreenKeyboard; @@ -112,7 +112,7 @@ static SDL_VideoDevice *UIKit_CreateDevice(void) device->HasClipboardText = UIKit_HasClipboardText; /* OpenGL (ES) functions */ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) device->GL_MakeCurrent = UIKit_GL_MakeCurrent; device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize; device->GL_SwapWindow = UIKit_GL_SwapWindow; @@ -123,7 +123,7 @@ static SDL_VideoDevice *UIKit_CreateDevice(void) #endif device->free = UIKit_DeleteDevice; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = UIKit_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = UIKit_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions @@ -132,7 +132,7 @@ static SDL_VideoDevice *UIKit_CreateDevice(void) device->Vulkan_GetDrawableSize = UIKit_Vulkan_GetDrawableSize; #endif -#if SDL_VIDEO_METAL +#ifdef SDL_VIDEO_METAL device->Metal_CreateView = UIKit_Metal_CreateView; device->Metal_DestroyView = UIKit_Metal_DestroyView; device->Metal_GetLayer = UIKit_Metal_GetLayer; diff --git a/src/video/uikit/SDL_uikitview.m b/src/video/uikit/SDL_uikitview.m index b9c332614..de00de2b3 100644 --- a/src/video/uikit/SDL_uikitview.m +++ b/src/video/uikit/SDL_uikitview.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_uikitview.h" @@ -38,7 +38,7 @@ #define MAX_MOUSE_BUTTONS 5 /* This is defined in SDL_sysjoystick.m */ -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED extern int SDL_AppleTVRemoteOpenedAsJoystick; #endif @@ -374,7 +374,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; } #endif -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED /* Presses from Apple TV remote */ if (!SDL_AppleTVRemoteOpenedAsJoystick) { switch (press.type) { @@ -458,7 +458,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick; { /* Swipe gestures don't trigger begin states. */ if (gesture.state == UIGestureRecognizerStateEnded) { -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (!SDL_AppleTVRemoteOpenedAsJoystick) { /* Send arrow key presses for now, as we don't have an external API * which better maps to swipe gestures. */ diff --git a/src/video/uikit/SDL_uikitviewcontroller.h b/src/video/uikit/SDL_uikitviewcontroller.h index 6fdcbecb0..e9f346a22 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.h +++ b/src/video/uikit/SDL_uikitviewcontroller.h @@ -33,7 +33,7 @@ #define SDLRootViewController UIViewController #endif -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD @interface SDL_uikitviewcontroller : SDLRootViewController #else @interface SDL_uikitviewcontroller : SDLRootViewController @@ -64,7 +64,7 @@ @property (nonatomic, assign) int homeIndicatorHidden; #endif -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD - (void)showKeyboard; - (void)hideKeyboard; - (void)initKeyboard; @@ -82,7 +82,7 @@ @end -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD SDL_bool UIKit_HasScreenKeyboardSupport(_THIS); void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window); void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window); diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m index b9ccf6b0f..1d79c7a40 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.m +++ b/src/video/uikit/SDL_uikitviewcontroller.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_video.h" #include "SDL_hints.h" @@ -70,7 +70,7 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o void (*animationCallback)(void*); void *animationCallbackParam; -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD UITextField *textField; BOOL hardwareKeyboard; BOOL showingKeyboard; @@ -88,7 +88,7 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o if (self = [super initWithNibName:nil bundle:nil]) { self.window = _window; -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD [self initKeyboard]; hardwareKeyboard = NO; showingKeyboard = NO; @@ -113,7 +113,7 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o - (void)dealloc { -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD [self deinitKeyboard]; #endif @@ -178,7 +178,7 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o /* Don't run the game loop while a messagebox is up */ if (!UIKit_ShowingMessageBox()) { /* See the comment in the function definition. */ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) UIKit_GL_RestoreCurrentContext(); #endif @@ -249,7 +249,7 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o /* ---- Keyboard related functionality below this line ---- */ -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD @synthesize textInputRect; @synthesize keyboardHeight; @@ -551,7 +551,7 @@ SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *o @end /* iPhone keyboard addition functions */ -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD static SDL_uikitviewcontroller *GetWindowViewController(SDL_Window * window) { diff --git a/src/video/uikit/SDL_uikitvulkan.h b/src/video/uikit/SDL_uikitvulkan.h index d8dd9183d..042857967 100644 --- a/src/video/uikit/SDL_uikitvulkan.h +++ b/src/video/uikit/SDL_uikitvulkan.h @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_UIKIT) int UIKit_Vulkan_LoadLibrary(_THIS, const char *path); void UIKit_Vulkan_UnloadLibrary(_THIS); diff --git a/src/video/uikit/SDL_uikitvulkan.m b/src/video/uikit/SDL_uikitvulkan.m index 892de1e0c..406207651 100644 --- a/src/video/uikit/SDL_uikitvulkan.m +++ b/src/video/uikit/SDL_uikitvulkan.m @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_UIKIT) #include "SDL_uikitvideo.h" #include "SDL_uikitwindow.h" diff --git a/src/video/uikit/SDL_uikitwindow.m b/src/video/uikit/SDL_uikitwindow.m index d69617983..b984f9674 100644 --- a/src/video/uikit/SDL_uikitwindow.m +++ b/src/video/uikit/SDL_uikitwindow.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_hints.h" #include "SDL_mouse.h" @@ -392,7 +392,7 @@ SDL_bool UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) /* These struct members were added in SDL 2.0.4. */ if (versionnum >= SDL_VERSIONNUM(2,0,4)) { -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) { SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view; info->info.uikit.framebuffer = glview.drawableFramebuffer; diff --git a/src/video/vita/SDL_vitaframebuffer.c b/src/video/vita/SDL_vitaframebuffer.c index e58ba333a..74e50ed96 100644 --- a/src/video/vita/SDL_vitaframebuffer.c +++ b/src/video/vita/SDL_vitaframebuffer.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include "SDL_vitavideo.h" diff --git a/src/video/vita/SDL_vitagl_pvr.c b/src/video/vita/SDL_vitagl_pvr.c index 140c1d9f0..402b019e1 100644 --- a/src/video/vita/SDL_vitagl_pvr.c +++ b/src/video/vita/SDL_vitagl_pvr.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR && SDL_VIDEO_VITA_PVR_OGL +#if defined(SDL_VIDEO_DRIVER_VITA) && defined(SDL_VIDEO_VITA_PVR) && defined(SDL_VIDEO_VITA_PVR_OGL) #include #include #include diff --git a/src/video/vita/SDL_vitagles.c b/src/video/vita/SDL_vitagles.c index 89f29d36a..5e3b252e6 100644 --- a/src/video/vita/SDL_vitagles.c +++ b/src/video/vita/SDL_vitagles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PIB +#if defined(SDL_VIDEO_DRIVER_VITA) && defined(SDL_VIDEO_VITA_PIB) #include #include diff --git a/src/video/vita/SDL_vitagles_pvr.c b/src/video/vita/SDL_vitagles_pvr.c index bf95abbec..0c58b94a1 100644 --- a/src/video/vita/SDL_vitagles_pvr.c +++ b/src/video/vita/SDL_vitagles_pvr.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR +#if defined(SDL_VIDEO_DRIVER_VITA) && defined(SDL_VIDEO_VITA_PVR) #include #include #include diff --git a/src/video/vita/SDL_vitakeyboard.c b/src/video/vita/SDL_vitakeyboard.c index 868985014..c87f1127d 100644 --- a/src/video/vita/SDL_vitakeyboard.c +++ b/src/video/vita/SDL_vitakeyboard.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include #include diff --git a/src/video/vita/SDL_vitamessagebox.c b/src/video/vita/SDL_vitamessagebox.c index 358271349..028f6c6c8 100644 --- a/src/video/vita/SDL_vitamessagebox.c +++ b/src/video/vita/SDL_vitamessagebox.c @@ -20,19 +20,19 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include "SDL_vitavideo.h" #include "SDL_vitamessagebox.h" #include -#if SDL_VIDEO_RENDER_VITA_GXM +#ifdef SDL_VIDEO_RENDER_VITA_GXM #include "../../render/vitagxm/SDL_render_vita_gxm_tools.h" #endif /* SDL_VIDEO_RENDER_VITA_GXM */ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { -#if SDL_VIDEO_RENDER_VITA_GXM +#ifdef SDL_VIDEO_RENDER_VITA_GXM SceMsgDialogParam param; SceMsgDialogUserMessageParam msgParam; SceMsgDialogButtonsParam buttonParam; diff --git a/src/video/vita/SDL_vitamessagebox.h b/src/video/vita/SDL_vitamessagebox.h index f119275b6..ef878dcd7 100644 --- a/src/video/vita/SDL_vitamessagebox.h +++ b/src/video/vita/SDL_vitamessagebox.h @@ -22,7 +22,7 @@ #ifndef SDL_vitamessagebox_h_ #define SDL_vitamessagebox_h_ -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA extern int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/src/video/vita/SDL_vitamouse.c b/src/video/vita/SDL_vitamouse.c index edec0bc50..e90af37ca 100644 --- a/src/video/vita/SDL_vitamouse.c +++ b/src/video/vita/SDL_vitamouse.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include #include diff --git a/src/video/vita/SDL_vitatouch.c b/src/video/vita/SDL_vitatouch.c index 7f22b855e..e0fd986d7 100644 --- a/src/video/vita/SDL_vitatouch.c +++ b/src/video/vita/SDL_vitatouch.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include #include diff --git a/src/video/vita/SDL_vitavideo.c b/src/video/vita/SDL_vitavideo.c index 0031e8eb3..7a3d64cc3 100644 --- a/src/video/vita/SDL_vitavideo.c +++ b/src/video/vita/SDL_vitavideo.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA /* SDL internals */ #include "../SDL_sysvideo.h" @@ -71,7 +71,7 @@ static SDL_VideoDevice *VITA_Create() { SDL_VideoDevice *device; SDL_VideoData *phdata; -#if SDL_VIDEO_VITA_PIB +#ifdef SDL_VIDEO_VITA_PIB SDL_GLDriverData *gldata; #endif /* Initialize SDL_VideoDevice structure */ @@ -88,7 +88,7 @@ static SDL_VideoDevice *VITA_Create() SDL_free(device); return NULL; } -#if SDL_VIDEO_VITA_PIB +#ifdef SDL_VIDEO_VITA_PIB gldata = (SDL_GLDriverData *)SDL_calloc(1, sizeof(SDL_GLDriverData)); if (!gldata) { diff --git a/src/video/vita/SDL_vitavideo.h b/src/video/vita/SDL_vitavideo.h index bafee68f3..367b80f10 100644 --- a/src/video/vita/SDL_vitavideo.h +++ b/src/video/vita/SDL_vitavideo.h @@ -86,7 +86,7 @@ void VITA_DestroyWindow(_THIS, SDL_Window *window); SDL_bool VITA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #if defined(SDL_VIDEO_VITA_PVR_OGL) /* OpenGL functions */ int VITA_GL_LoadLibrary(_THIS, const char *path); diff --git a/src/video/vivante/SDL_vivanteopengles.c b/src/video/vivante/SDL_vivanteopengles.c index 9d9c6388b..7d135a9cf 100644 --- a/src/video/vivante/SDL_vivanteopengles.c +++ b/src/video/vivante/SDL_vivanteopengles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_VIVANTE) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_vivanteopengles.h" #include "SDL_vivantevideo.h" diff --git a/src/video/vivante/SDL_vivanteopengles.h b/src/video/vivante/SDL_vivanteopengles.h index 8e420a1a5..517f11af0 100644 --- a/src/video/vivante/SDL_vivanteopengles.h +++ b/src/video/vivante/SDL_vivanteopengles.h @@ -23,7 +23,7 @@ #ifndef SDL_vivanteopengles_h_ #define SDL_vivanteopengles_h_ -#if SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_VIVANTE) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/src/video/vivante/SDL_vivanteplatform.c b/src/video/vivante/SDL_vivanteplatform.c index 8d3aff3df..ba9c95351 100644 --- a/src/video/vivante/SDL_vivanteplatform.c +++ b/src/video/vivante/SDL_vivanteplatform.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VIVANTE +#ifdef SDL_VIDEO_DRIVER_VIVANTE #include "SDL_vivanteplatform.h" diff --git a/src/video/vivante/SDL_vivanteplatform.h b/src/video/vivante/SDL_vivanteplatform.h index 69ce9bd1f..44cde5d0c 100644 --- a/src/video/vivante/SDL_vivanteplatform.h +++ b/src/video/vivante/SDL_vivanteplatform.h @@ -23,7 +23,7 @@ #ifndef SDL_vivanteplatform_h_ #define SDL_vivanteplatform_h_ -#if SDL_VIDEO_DRIVER_VIVANTE +#ifdef SDL_VIDEO_DRIVER_VIVANTE #include "SDL_vivantevideo.h" diff --git a/src/video/vivante/SDL_vivantevideo.c b/src/video/vivante/SDL_vivantevideo.c index b1e6127ba..061286f2f 100644 --- a/src/video/vivante/SDL_vivantevideo.c +++ b/src/video/vivante/SDL_vivantevideo.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VIVANTE +#ifdef SDL_VIDEO_DRIVER_VIVANTE /* SDL internals */ #include "../SDL_sysvideo.h" @@ -89,7 +89,7 @@ static SDL_VideoDevice *VIVANTE_Create() device->DestroyWindow = VIVANTE_DestroyWindow; device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary; device->GL_GetProcAddress = VIVANTE_GLES_GetProcAddress; device->GL_UnloadLibrary = VIVANTE_GLES_UnloadLibrary; @@ -101,7 +101,7 @@ static SDL_VideoDevice *VIVANTE_Create() device->GL_DeleteContext = VIVANTE_GLES_DeleteContext; #endif -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = VIVANTE_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = VIVANTE_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = VIVANTE_Vulkan_GetInstanceExtensions; @@ -138,7 +138,7 @@ static int VIVANTE_AddVideoDisplays(_THIS) } SDL_zero(current_mode); -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK data->native_display = vdkGetDisplay(videodata->vdk_private); vdkGetDisplayInfo(data->native_display, ¤t_mode.w, ¤t_mode.h, &pixels, &pitch, &bpp); @@ -173,7 +173,7 @@ int VIVANTE_VideoInit(_THIS) { SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK videodata->vdk_private = vdkInitialize(); if (!videodata->vdk_private) { return SDL_SetError("vdkInitialize() failed"); @@ -231,7 +231,7 @@ void VIVANTE_VideoQuit(_THIS) VIVANTE_CleanupPlatform(_this); -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK if (videodata->vdk_private) { vdkExit(videodata->vdk_private); videodata->vdk_private = NULL; @@ -272,7 +272,7 @@ int VIVANTE_CreateWindow(_THIS, SDL_Window *window) /* Setup driver data for this window */ window->driverdata = data; -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK data->native_window = vdkCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h); #else data->native_window = videodata->fbCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h); @@ -281,7 +281,7 @@ int VIVANTE_CreateWindow(_THIS, SDL_Window *window) return SDL_SetError("VIVANTE: Can't create native window"); } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { data->egl_surface = SDL_EGL_CreateSurface(_this, data->native_window); if (data->egl_surface == EGL_NO_SURFACE) { @@ -303,14 +303,14 @@ void VIVANTE_DestroyWindow(_THIS, SDL_Window *window) data = window->driverdata; if (data) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } #endif if (data->native_window) { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK vdkDestroyWindow(data->native_window); #else videodata->fbDestroyWindow(data->native_window); @@ -324,7 +324,7 @@ void VIVANTE_DestroyWindow(_THIS, SDL_Window *window) void VIVANTE_SetWindowTitle(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK SDL_WindowData *data = window->driverdata; vdkSetWindowTitle(data->native_window, window->title); #endif @@ -342,7 +342,7 @@ void VIVANTE_SetWindowSize(_THIS, SDL_Window *window) void VIVANTE_ShowWindow(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK SDL_WindowData *data = window->driverdata; vdkShowWindow(data->native_window); #endif @@ -352,7 +352,7 @@ void VIVANTE_ShowWindow(_THIS, SDL_Window *window) void VIVANTE_HideWindow(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK SDL_WindowData *data = window->driverdata; vdkHideWindow(data->native_window); #endif diff --git a/src/video/vivante/SDL_vivantevideo.h b/src/video/vivante/SDL_vivantevideo.h index f68f0f925..0d6f5700e 100644 --- a/src/video/vivante/SDL_vivantevideo.h +++ b/src/video/vivante/SDL_vivantevideo.h @@ -27,7 +27,7 @@ #include "SDL_egl.h" -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK #include #else #include @@ -35,7 +35,7 @@ typedef struct SDL_VideoData { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK vdkPrivate vdk_private; #else void *egl_handle; /* EGL shared library handle */ diff --git a/src/video/vivante/SDL_vivantevulkan.c b/src/video/vivante/SDL_vivantevulkan.c index 3183721c1..81be2357a 100644 --- a/src/video/vivante/SDL_vivantevulkan.c +++ b/src/video/vivante/SDL_vivantevulkan.c @@ -27,7 +27,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_VIVANTE +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_VIVANTE) #include "SDL_vivantevideo.h" diff --git a/src/video/vivante/SDL_vivantevulkan.h b/src/video/vivante/SDL_vivantevulkan.h index 1b0500c21..85b2a71a1 100644 --- a/src/video/vivante/SDL_vivantevulkan.h +++ b/src/video/vivante/SDL_vivantevulkan.h @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_VIVANTE +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_VIVANTE) int VIVANTE_Vulkan_LoadLibrary(_THIS, const char *path); void VIVANTE_Vulkan_UnloadLibrary(_THIS); diff --git a/src/video/wayland/SDL_waylandclipboard.c b/src/video/wayland/SDL_waylandclipboard.c index d643a51ef..ddddb3807 100644 --- a/src/video/wayland/SDL_waylandclipboard.c +++ b/src/video/wayland/SDL_waylandclipboard.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "SDL_waylanddatamanager.h" #include "SDL_waylandevents_c.h" diff --git a/src/video/wayland/SDL_waylanddatamanager.c b/src/video/wayland/SDL_waylanddatamanager.c index d430bdbce..6c12a8679 100644 --- a/src/video/wayland/SDL_waylanddatamanager.c +++ b/src/video/wayland/SDL_waylanddatamanager.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include #include @@ -55,7 +55,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_ sigemptyset(&sig_set); sigaddset(&sig_set, SIGPIPE); -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED sigprocmask(SIG_BLOCK, &sig_set, &old_sig_set); #else pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set); @@ -77,7 +77,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_ sigtimedwait(&sig_set, 0, &zerotime); -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED sigprocmask(SIG_SETMASK, &old_sig_set, NULL); #else pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL); diff --git a/src/video/wayland/SDL_waylanddyn.c b/src/video/wayland/SDL_waylanddyn.c index 4084a371f..46dca83ca 100644 --- a/src/video/wayland/SDL_waylanddyn.c +++ b/src/video/wayland/SDL_waylanddyn.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #define DEBUG_DYNAMIC_WAYLAND 0 diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 276963837..7e6ff8928 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "SDL_stdinc.h" #include "SDL_timer.h" diff --git a/src/video/wayland/SDL_waylandkeyboard.c b/src/video/wayland/SDL_waylandkeyboard.c index 999f87e29..4b7f185d0 100644 --- a/src/video/wayland/SDL_waylandkeyboard.c +++ b/src/video/wayland/SDL_waylandkeyboard.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "../SDL_sysvideo.h" #include "SDL_waylandvideo.h" diff --git a/src/video/wayland/SDL_waylandmessagebox.c b/src/video/wayland/SDL_waylandmessagebox.c index e57b12f02..636868e24 100644 --- a/src/video/wayland/SDL_waylandmessagebox.c +++ b/src/video/wayland/SDL_waylandmessagebox.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "SDL.h" #include /* fgets */ diff --git a/src/video/wayland/SDL_waylandmessagebox.h b/src/video/wayland/SDL_waylandmessagebox.h index 277577419..622007d43 100644 --- a/src/video/wayland/SDL_waylandmessagebox.h +++ b/src/video/wayland/SDL_waylandmessagebox.h @@ -22,7 +22,7 @@ #ifndef SDL_waylandmessagebox_h_ #define SDL_waylandmessagebox_h_ -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND extern int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/src/video/wayland/SDL_waylandmouse.c b/src/video/wayland/SDL_waylandmouse.c index 6e7e9d5a8..af392b366 100644 --- a/src/video/wayland/SDL_waylandmouse.c +++ b/src/video/wayland/SDL_waylandmouse.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include #include @@ -179,7 +179,7 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa if ((xcursor_size = SDL_getenv("XCURSOR_SIZE"))) { size = SDL_atoi(xcursor_size); } -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (size <= 0) { wayland_dbus_read_cursor_size(&size); } @@ -215,7 +215,7 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa return SDL_FALSE; } xcursor_theme = SDL_getenv("XCURSOR_THEME"); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (!xcursor_theme) { /* Allocates the string with SDL_strdup, which must be freed. */ free_theme_str = wayland_dbus_read_cursor_theme(&xcursor_theme); diff --git a/src/video/wayland/SDL_waylandmouse.h b/src/video/wayland/SDL_waylandmouse.h index dd3e8f83d..3bc7bb1bd 100644 --- a/src/video/wayland/SDL_waylandmouse.h +++ b/src/video/wayland/SDL_waylandmouse.h @@ -23,7 +23,7 @@ #include "SDL_mouse.h" #include "SDL_waylandvideo.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND extern void Wayland_InitMouse(void); extern void Wayland_FiniMouse(SDL_VideoData *data); diff --git a/src/video/wayland/SDL_waylandopengles.c b/src/video/wayland/SDL_waylandopengles.c index 41e84fbaf..0576a76ab 100644 --- a/src/video/wayland/SDL_waylandopengles.c +++ b/src/video/wayland/SDL_waylandopengles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_WAYLAND) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_timer.h" #include "../../core/unix/SDL_poll.h" diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index b2db37ce0..4670317d7 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "SDL_video.h" #include "SDL_mouse.h" @@ -227,7 +227,7 @@ static SDL_VideoDevice *Wayland_CreateDevice(void) device->WaitEventTimeout = Wayland_WaitEventTimeout; device->SendWakeupEvent = Wayland_SendWakeupEvent; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL device->GL_SwapWindow = Wayland_GLES_SwapWindow; device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval; device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval; @@ -273,7 +273,7 @@ static SDL_VideoDevice *Wayland_CreateDevice(void) device->StopTextInput = Wayland_StopTextInput; device->SetTextInputRect = Wayland_SetTextInputRect; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = Wayland_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions; diff --git a/src/video/wayland/SDL_waylandvulkan.c b/src/video/wayland/SDL_waylandvulkan.c index c3712ed68..500aaf09e 100644 --- a/src/video/wayland/SDL_waylandvulkan.c +++ b/src/video/wayland/SDL_waylandvulkan.c @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WAYLAND) #include "SDL_waylandvideo.h" #include "SDL_waylandwindow.h" diff --git a/src/video/wayland/SDL_waylandvulkan.h b/src/video/wayland/SDL_waylandvulkan.h index c22e34df6..c237c58a3 100644 --- a/src/video/wayland/SDL_waylandvulkan.h +++ b/src/video/wayland/SDL_waylandvulkan.h @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WAYLAND) int Wayland_Vulkan_LoadLibrary(_THIS, const char *path); void Wayland_Vulkan_UnloadLibrary(_THIS); diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 6a773de56..69384e792 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "../SDL_sysvideo.h" #include "../../events/SDL_windowevents_c.h" @@ -2059,7 +2059,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) if (window->flags & SDL_WINDOW_OPENGL) { data->egl_window = WAYLAND_wl_egl_window_create(data->surface, data->drawable_width, data->drawable_height); -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Create the GLES window surface */ data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)data->egl_window); @@ -2218,7 +2218,7 @@ void Wayland_SuspendScreenSaver(_THIS) { SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (SDL_DBus_ScreensaverInhibit(_this->suspend_screensaver)) { return; } @@ -2257,7 +2257,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) SDL_WindowData *wind = window->driverdata; if (data) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (wind->egl_surface) { SDL_EGL_DestroySurface(_this, wind->egl_surface); } diff --git a/src/video/wayland/SDL_waylandwindow.h b/src/video/wayland/SDL_waylandwindow.h index 89f0d7766..4454cce9e 100644 --- a/src/video/wayland/SDL_waylandwindow.h +++ b/src/video/wayland/SDL_waylandwindow.h @@ -78,7 +78,7 @@ typedef struct struct wl_egl_window *egl_window; struct SDL_WaylandInput *keyboard_device; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif struct zwp_locked_pointer_v1 *locked_pointer; diff --git a/src/video/windows/SDL_windowsclipboard.c b/src/video/windows/SDL_windowsclipboard.c index 49e852e5e..a8c4a2b0c 100644 --- a/src/video/windows/SDL_windowsclipboard.c +++ b/src/video/windows/SDL_windowsclipboard.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c index b172b7201..db9776e3e 100644 --- a/src/video/windows/SDL_windowsevents.c +++ b/src/video/windows/SDL_windowsevents.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "SDL_windowsvideo.h" #include "SDL_windowsshape.h" @@ -43,7 +43,7 @@ #include /* For WM_TABLET_QUERYSYSTEMGESTURESTATUS et. al. */ -#if HAVE_TPCSHRD_H +#ifdef HAVE_TPCSHRD_H #include #endif /* HAVE_TPCSHRD_H */ @@ -1422,7 +1422,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } break; -#if HAVE_TPCSHRD_H +#ifdef HAVE_TPCSHRD_H case WM_TABLET_QUERYSYSTEMGESTURESTATUS: /* See https://msdn.microsoft.com/en-us/library/windows/desktop/bb969148(v=vs.85).aspx . diff --git a/src/video/windows/SDL_windowsframebuffer.c b/src/video/windows/SDL_windowsframebuffer.c index 0c0f64780..7b82b783d 100644 --- a/src/video/windows/SDL_windowsframebuffer.c +++ b/src/video/windows/SDL_windowsframebuffer.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" diff --git a/src/video/windows/SDL_windowskeyboard.c b/src/video/windows/SDL_windowskeyboard.c index 01a9977f1..ced9dcc51 100644 --- a/src/video/windows/SDL_windowskeyboard.c +++ b/src/video/windows/SDL_windowskeyboard.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "SDL_hints.h" diff --git a/src/video/windows/SDL_windowsmessagebox.c b/src/video/windows/SDL_windowsmessagebox.c index 246c9cada..a59edcb88 100644 --- a/src/video/windows/SDL_windowsmessagebox.c +++ b/src/video/windows/SDL_windowsmessagebox.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #ifdef HAVE_LIMITS_H #include diff --git a/src/video/windows/SDL_windowsmessagebox.h b/src/video/windows/SDL_windowsmessagebox.h index b87ecfde7..d3d3ba0d5 100644 --- a/src/video/windows/SDL_windowsmessagebox.h +++ b/src/video/windows/SDL_windowsmessagebox.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if defined(SDL_VIDEO_DRIVER_WINDOWS) extern int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/src/video/windows/SDL_windowsmodes.c b/src/video/windows/SDL_windowsmodes.c index f0e3d34ef..72348cf5e 100644 --- a/src/video/windows/SDL_windowsmodes.c +++ b/src/video/windows/SDL_windowsmodes.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "../../events/SDL_displayevents_c.h" diff --git a/src/video/windows/SDL_windowsmouse.c b/src/video/windows/SDL_windowsmouse.c index 3840cd311..bb2ef188b 100644 --- a/src/video/windows/SDL_windowsmouse.c +++ b/src/video/windows/SDL_windowsmouse.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c index 851594835..8bbd62e4a 100644 --- a/src/video/windows/SDL_windowsopengl.c +++ b/src/video/windows/SDL_windowsopengl.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "SDL_loadso.h" #include "SDL_windowsvideo.h" @@ -29,7 +29,7 @@ /* WGL implementation of SDL OpenGL support */ -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL #include "SDL_opengl.h" #define DEFAULT_OPENGL "OPENGL32.DLL" @@ -97,7 +97,7 @@ typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC hDC, const int *attribList); -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) #define GetDC(hwnd) (HDC) hwnd #define ReleaseDC(hwnd, hdc) 1 #define SwapBuffers _this->gl_data->wglSwapBuffers @@ -145,7 +145,7 @@ int WIN_GL_LoadLibrary(_THIS, const char *path) SDL_LoadFunction(handle, "wglShareLists"); /* *INDENT-ON* */ /* clang-format on */ -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) _this->gl_data->wglSwapBuffers = (BOOL(WINAPI *)(HDC)) SDL_LoadFunction(handle, "wglSwapBuffers"); _this->gl_data->wglDescribePixelFormat = (int(WINAPI *)(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR)) @@ -162,7 +162,7 @@ int WIN_GL_LoadLibrary(_THIS, const char *path) !_this->gl_data->wglCreateContext || !_this->gl_data->wglDeleteContext || !_this->gl_data->wglMakeCurrent -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) || !_this->gl_data->wglSwapBuffers || !_this->gl_data->wglDescribePixelFormat || !_this->gl_data->wglChoosePixelFormat || @@ -702,7 +702,7 @@ SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window *window) HGLRC context, share_context; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && WIN_GL_UseEGL(_this)) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Switch to EGL based functions */ WIN_GL_UnloadLibrary(_this); _this->GL_LoadLibrary = WIN_GLES_LoadLibrary; diff --git a/src/video/windows/SDL_windowsopengl.h b/src/video/windows/SDL_windowsopengl.h index 0d30068ad..423a662fa 100644 --- a/src/video/windows/SDL_windowsopengl.h +++ b/src/video/windows/SDL_windowsopengl.h @@ -23,9 +23,9 @@ #ifndef SDL_windowsopengl_h_ #define SDL_windowsopengl_h_ -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) typedef struct tagPIXELFORMATDESCRIPTOR { WORD nSize; @@ -85,7 +85,7 @@ struct SDL_GLDriverData BOOL (WINAPI *wglGetPixelFormatAttribivARB)(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); BOOL (WINAPI *wglSwapIntervalEXT)(int interval); int (WINAPI *wglGetSwapIntervalEXT)(void); -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) BOOL (WINAPI *wglSwapBuffers)(HDC hdc); int (WINAPI *wglDescribePixelFormat)(HDC hdc, int iPixelFormat, diff --git a/src/video/windows/SDL_windowsopengles.c b/src/video/windows/SDL_windowsopengles.c index cad4479f4..e33cddec0 100644 --- a/src/video/windows/SDL_windowsopengles.c +++ b/src/video/windows/SDL_windowsopengles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && defined(SDL_VIDEO_OPENGL_EGL) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "SDL_windowsopengles.h" @@ -34,7 +34,7 @@ int WIN_GLES_LoadLibrary(_THIS, const char *path) /* If the profile requested is not GL ES, switch over to WIN_GL functions */ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL WIN_GLES_UnloadLibrary(_this); _this->GL_LoadLibrary = WIN_GL_LoadLibrary; _this->GL_GetProcAddress = WIN_GL_GetProcAddress; @@ -63,7 +63,7 @@ SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window *window) SDL_GLContext context; SDL_WindowData *data = (SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { /* Switch to WGL based functions */ WIN_GLES_UnloadLibrary(_this); diff --git a/src/video/windows/SDL_windowsopengles.h b/src/video/windows/SDL_windowsopengles.h index 65b71f5c8..391618588 100644 --- a/src/video/windows/SDL_windowsopengles.h +++ b/src/video/windows/SDL_windowsopengles.h @@ -23,7 +23,7 @@ #ifndef SDL_winopengles_h_ #define SDL_winopengles_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c index b00e44760..981079237 100644 --- a/src/video/windows/SDL_windowsshape.c +++ b/src/video/windows/SDL_windowsshape.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsshape.h" #include "SDL_windowsvideo.h" diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c index 6ff6fd43c..2ca0b7675 100644 --- a/src/video/windows/SDL_windowsvideo.c +++ b/src/video/windows/SDL_windowsvideo.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "SDL_main.h" #include "SDL_video.h" @@ -215,7 +215,7 @@ static SDL_VideoDevice *WIN_CreateDevice(void) device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape; #endif -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL device->GL_LoadLibrary = WIN_GL_LoadLibrary; device->GL_GetProcAddress = WIN_GL_GetProcAddress; device->GL_UnloadLibrary = WIN_GL_UnloadLibrary; @@ -225,7 +225,7 @@ static SDL_VideoDevice *WIN_CreateDevice(void) device->GL_GetSwapInterval = WIN_GL_GetSwapInterval; device->GL_SwapWindow = WIN_GL_SwapWindow; device->GL_DeleteContext = WIN_GL_DeleteContext; -#elif SDL_VIDEO_OPENGL_EGL +#elif defined(SDL_VIDEO_OPENGL_EGL) /* Use EGL based functions */ device->GL_LoadLibrary = WIN_GLES_LoadLibrary; device->GL_GetProcAddress = WIN_GLES_GetProcAddress; @@ -237,7 +237,7 @@ static SDL_VideoDevice *WIN_CreateDevice(void) device->GL_SwapWindow = WIN_GLES_SwapWindow; device->GL_DeleteContext = WIN_GLES_DeleteContext; #endif -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = WIN_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions; diff --git a/src/video/windows/SDL_windowsvulkan.c b/src/video/windows/SDL_windowsvulkan.c index 17643f44a..f30bb3a58 100644 --- a/src/video/windows/SDL_windowsvulkan.c +++ b/src/video/windows/SDL_windowsvulkan.c @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WINDOWS) #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" diff --git a/src/video/windows/SDL_windowsvulkan.h b/src/video/windows/SDL_windowsvulkan.h index b2fe17ded..abcad3b15 100644 --- a/src/video/windows/SDL_windowsvulkan.h +++ b/src/video/windows/SDL_windowsvulkan.h @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WINDOWS) int WIN_Vulkan_LoadLibrary(_THIS, const char *path); void WIN_Vulkan_UnloadLibrary(_THIS); diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index ea11132ec..b1583fefd 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "../../core/windows/SDL_windows.h" @@ -537,13 +537,13 @@ int WIN_CreateWindow(_THIS, SDL_Window *window) } /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ -#if SDL_VIDEO_OPENGL_ES2 +#ifdef SDL_VIDEO_OPENGL_ES2 if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL && (!_this->gl_data || WIN_GL_UseEGL(_this)) #endif /* SDL_VIDEO_OPENGL_WGL */ ) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (WIN_GLES_SetupWindow(_this, window) < 0) { WIN_DestroyWindow(_this, window); return -1; @@ -555,7 +555,7 @@ int WIN_CreateWindow(_THIS, SDL_Window *window) } #endif /* SDL_VIDEO_OPENGL_ES2 */ -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL if (WIN_GL_SetupWindow(_this, window) < 0) { WIN_DestroyWindow(_this, window); return -1; @@ -596,7 +596,7 @@ int WIN_CreateWindowFrom(_THIS, SDL_Window *window, const void *data) return -1; } -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL { const char *hint = SDL_GetHint(SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT); if (hint) { diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h index fe2e35f58..51e1c1414 100644 --- a/src/video/windows/SDL_windowswindow.h +++ b/src/video/windows/SDL_windowswindow.h @@ -23,7 +23,7 @@ #ifndef SDL_windowswindow_h_ #define SDL_windowswindow_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_egl_c.h" #else #include "../SDL_sysvideo.h" @@ -64,7 +64,7 @@ typedef struct SDL_bool mouse_tracked; WCHAR *ICMFileName; struct SDL_VideoData *videodata; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif /** diff --git a/src/video/winrt/SDL_winrtevents.cpp b/src/video/winrt/SDL_winrtevents.cpp index 30d1fac4b..c8f6a5dae 100644 --- a/src/video/winrt/SDL_winrtevents.cpp +++ b/src/video/winrt/SDL_winrtevents.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* * Windows includes: diff --git a/src/video/winrt/SDL_winrtgamebar.cpp b/src/video/winrt/SDL_winrtgamebar.cpp index 1db0d0e34..7dd64166e 100644 --- a/src/video/winrt/SDL_winrtgamebar.cpp +++ b/src/video/winrt/SDL_winrtgamebar.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* Windows includes */ #include diff --git a/src/video/winrt/SDL_winrtkeyboard.cpp b/src/video/winrt/SDL_winrtkeyboard.cpp index 9e6e141c4..a0de296b0 100644 --- a/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/src/video/winrt/SDL_winrtkeyboard.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* Windows-specific includes */ #include diff --git a/src/video/winrt/SDL_winrtmessagebox.cpp b/src/video/winrt/SDL_winrtmessagebox.cpp index 42a8f3207..4cd392cc0 100644 --- a/src/video/winrt/SDL_winrtmessagebox.cpp +++ b/src/video/winrt/SDL_winrtmessagebox.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT extern "C" { #include "SDL_messagebox.h" @@ -43,7 +43,7 @@ static String ^ WINRT_UTF8ToPlatformString(const char *str) { extern "C" int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8) +#if SDL_WINAPI_FAMILY_PHONE && (NTDDI_VERSION == NTDDI_WIN8) /* Sadly, Windows Phone 8 doesn't include the MessageDialog class that * Windows 8.x/RT does, even though MSDN's reference documentation for * Windows Phone 8 mentions it. @@ -55,7 +55,7 @@ static String ^ WINRT_UTF8ToPlatformString(const char *str) { #else SDL_VideoDevice *_this = SDL_GetVideoDevice(); -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE const int maxbuttons = 2; const char *platform = "Windows Phone 8.1+"; #else @@ -106,7 +106,7 @@ static String ^ WINRT_UTF8ToPlatformString(const char *str) { *buttonid = messageboxdata->buttons[clicked_index].buttonid; } return 0; -#endif /* if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP / else */ +#endif /* if SDL_WINAPI_FAMILY_PHONE / else */ } #endif /* SDL_VIDEO_DRIVER_WINRT */ diff --git a/src/video/winrt/SDL_winrtmessagebox.h b/src/video/winrt/SDL_winrtmessagebox.h index 4ea65c550..7b4eacd7b 100644 --- a/src/video/winrt/SDL_winrtmessagebox.h +++ b/src/video/winrt/SDL_winrtmessagebox.h @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT extern int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/src/video/winrt/SDL_winrtmouse.cpp b/src/video/winrt/SDL_winrtmouse.cpp index 05fae956a..903f6917f 100644 --- a/src/video/winrt/SDL_winrtmouse.cpp +++ b/src/video/winrt/SDL_winrtmouse.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* * Windows includes: @@ -215,7 +215,7 @@ void WINRT_InitMouse(_THIS) - programmatically moveable cursors */ -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE // mouse->CreateCursor = WINRT_CreateCursor; mouse->CreateSystemCursor = WINRT_CreateSystemCursor; mouse->ShowCursor = WINRT_ShowCursor; diff --git a/src/video/winrt/SDL_winrtopengles.cpp b/src/video/winrt/SDL_winrtopengles.cpp index 34889595b..bf834ebe7 100644 --- a/src/video/winrt/SDL_winrtopengles.cpp +++ b/src/video/winrt/SDL_winrtopengles.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_WINRT) && defined(SDL_VIDEO_OPENGL_EGL) /* EGL implementation of SDL OpenGL support */ @@ -144,7 +144,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) return SDL_EGL_SetError("Could not retrieve ANGLE/WinRT display function(s)", "eglGetProcAddress"); } -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#if !SDL_WINAPI_FAMILY_PHONE /* Try initializing EGL at D3D11 Feature Level 10_0+ (which is not * supported on WinPhone 8.x. */ diff --git a/src/video/winrt/SDL_winrtopengles.h b/src/video/winrt/SDL_winrtopengles.h index dc495609d..385dbd944 100644 --- a/src/video/winrt/SDL_winrtopengles.h +++ b/src/video/winrt/SDL_winrtopengles.h @@ -23,7 +23,7 @@ #ifndef SDL_winrtopengles_h_ #define SDL_winrtopengles_h_ -#if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_WINRT) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/src/video/winrt/SDL_winrtpointerinput.cpp b/src/video/winrt/SDL_winrtpointerinput.cpp index e80d99dfe..0d8b52a71 100644 --- a/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/src/video/winrt/SDL_winrtpointerinput.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* SDL includes */ #include "SDL_winrtevents_c.h" @@ -78,7 +78,7 @@ WINRT_TransformCursorPosition(SDL_Window *window, // Compute coordinates normalized from 0..1. // If the coordinates need to be sized to the SDL window, // we'll do that after. -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8) +#if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION > NTDDI_WIN8) outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width; outputPosition.Y = rawPosition.Y / nativeWindow->Bounds.Height; #else @@ -116,7 +116,7 @@ SDL_bool WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint ^ pt { using namespace Windows::UI::Input; -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE *button = SDL_BUTTON_LEFT; return SDL_TRUE; #else @@ -197,7 +197,7 @@ SDL_bool WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint ^ pt static bool WINRT_IsTouchEvent(Windows::UI::Input::PointerPoint ^ pointerPoint) { -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE return true; #else using namespace Windows::Devices::Input; diff --git a/src/video/winrt/SDL_winrtvideo.cpp b/src/video/winrt/SDL_winrtvideo.cpp index 594709dcb..ef5464d00 100644 --- a/src/video/winrt/SDL_winrtvideo.cpp +++ b/src/video/winrt/SDL_winrtvideo.cpp @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* WinRT SDL video driver implementation @@ -406,7 +406,7 @@ static int WINRT_AddDisplaysForAdapter(_THIS, IDXGIFactory2 *dxgiFactory2, int a if (adapterIndex == 0 && outputIndex == 0) { SDL_VideoDisplay display; SDL_DisplayMode mode; -#if SDL_WINRT_USE_APPLICATIONVIEW +#ifdef SDL_WINRT_USE_APPLICATIONVIEW ApplicationView ^ appView = ApplicationView::GetForCurrentView(); #endif CoreWindow ^ coreWin = CoreWindow::GetForCurrentThread(); @@ -421,7 +421,7 @@ static int WINRT_AddDisplaysForAdapter(_THIS, IDXGIFactory2 *dxgiFactory2, int a failing test), whereas CoreWindow might not. -- DavidL */ -#if (NTDDI_VERSION >= NTDDI_WIN10) || (SDL_WINRT_USE_APPLICATIONVIEW && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +#if (NTDDI_VERSION >= NTDDI_WIN10) || (defined(SDL_WINRT_USE_APPLICATIONVIEW) && SDL_WINAPI_FAMILY_PHONE) mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width); mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height); #else @@ -500,11 +500,11 @@ WINRT_DetectWindowFlags(SDL_Window *window) SDL_WindowData *data = (SDL_WindowData *)window->driverdata; bool is_fullscreen = false; -#if SDL_WINRT_USE_APPLICATIONVIEW +#ifdef SDL_WINRT_USE_APPLICATIONVIEW if (data->appView) { is_fullscreen = data->appView->IsFullScreenMode; } -#elif (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION == NTDDI_WIN8) +#elif SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION == NTDDI_WIN8) is_fullscreen = true; #endif @@ -514,13 +514,13 @@ WINRT_DetectWindowFlags(SDL_Window *window) int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8) +#if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION > NTDDI_WIN8) // On all WinRT platforms, except for WinPhone 8.0, rotate the // window size. This is needed to properly calculate // fullscreen vs. maximized. const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation); switch (currentOrientation) { -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +#if SDL_WINAPI_FAMILY_PHONE case DisplayOrientations::Landscape: case DisplayOrientations::LandscapeFlipped: #else @@ -548,7 +548,7 @@ WINRT_DetectWindowFlags(SDL_Window *window) latestFlags |= SDL_WINDOW_HIDDEN; } -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION < NTDDI_WINBLUE) +#if SDL_WINAPI_FAMILY_PHONE && (NTDDI_VERSION < NTDDI_WINBLUE) // data->coreWindow->PointerPosition is not supported on WinPhone 8.0 latestFlags |= SDL_WINDOW_MOUSE_FOCUS; #else @@ -622,7 +622,7 @@ int WINRT_CreateWindow(_THIS, SDL_Window *window) */ if (!WINRT_XAMLWasEnabled) { data->coreWindow = CoreWindow::GetForCurrentThread(); -#if SDL_WINRT_USE_APPLICATIONVIEW +#ifdef SDL_WINRT_USE_APPLICATIONVIEW data->appView = ApplicationView::GetForCurrentView(); #endif } @@ -630,7 +630,7 @@ int WINRT_CreateWindow(_THIS, SDL_Window *window) /* Make note of the requested window flags, before they start getting changed. */ const Uint32 requestedFlags = window->flags; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Setup the EGL surface, but only if OpenGL ES 2 was requested. */ if (!(window->flags & SDL_WINDOW_OPENGL)) { /* OpenGL ES 2 wasn't requested. Don't set up an EGL surface. */ @@ -685,7 +685,7 @@ int WINRT_CreateWindow(_THIS, SDL_Window *window) SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface) { window->flags |= SDL_WINDOW_OPENGL; } diff --git a/src/video/winrt/SDL_winrtvideo_cpp.h b/src/video/winrt/SDL_winrtvideo_cpp.h index a34b79e60..1bb349241 100644 --- a/src/video/winrt/SDL_winrtvideo_cpp.h +++ b/src/video/winrt/SDL_winrtvideo_cpp.h @@ -99,7 +99,7 @@ struct SDL_WindowData #ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif -#if SDL_WINRT_USE_APPLICATIONVIEW +#ifdef SDL_WINRT_USE_APPLICATIONVIEW Windows::UI::ViewManagement::ApplicationView ^ appView; #endif }; diff --git a/src/video/x11/SDL_x11clipboard.c b/src/video/x11/SDL_x11clipboard.c index 39198e74d..b036e8da6 100644 --- a/src/video/x11/SDL_x11clipboard.c +++ b/src/video/x11/SDL_x11clipboard.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include /* For INT_MAX */ diff --git a/src/video/x11/SDL_x11dyn.c b/src/video/x11/SDL_x11dyn.c index f0b14feec..010eaa319 100644 --- a/src/video/x11/SDL_x11dyn.c +++ b/src/video/x11/SDL_x11dyn.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #define DEBUG_DYNAMIC_X11 0 diff --git a/src/video/x11/SDL_x11dyn.h b/src/video/x11/SDL_x11dyn.h index a18e41f24..c2f704319 100644 --- a/src/video/x11/SDL_x11dyn.h +++ b/src/video/x11/SDL_x11dyn.h @@ -27,7 +27,7 @@ #include #include -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM #include #endif @@ -46,25 +46,25 @@ #include #endif -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR #include #endif -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE #include #endif -#if SDL_VIDEO_DRIVER_X11_XINPUT2 || SDL_VIDEO_DRIVER_X11_XFIXES +#if defined(SDL_VIDEO_DRIVER_X11_XINPUT2) || defined(SDL_VIDEO_DRIVER_X11_XFIXES) #include #endif -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES #include #endif -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR #include #endif -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER #include #endif -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE #include #endif diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 518c1ca3f..2b52d33d7 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include #include @@ -324,7 +324,7 @@ static char *X11_URIToLocal(char *uri) return file; } -#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS +#ifdef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev) { /* event is a union, so cookie == &event, but this is type safe. */ @@ -841,14 +841,14 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) return; } -#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS +#ifdef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS if (xevent->type == GenericEvent) { X11_HandleGenericEvent(videodata, xevent); return; } #endif -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR if (videodata->xrandr_event_base && (xevent->type == (videodata->xrandr_event_base + RRNotify))) { X11_HandleXRandREvent(_this, xevent); } @@ -981,7 +981,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) mouse->last_x = xevent->xcrossing.x; mouse->last_y = xevent->xcrossing.y; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES { /* Only create the barriers if we have input focus */ SDL_WindowData *windowdata = (SDL_WindowData *)data->window->driverdata; @@ -1093,7 +1093,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) data->pending_focus_time = SDL_GetTicks() + PENDING_FOCUS_TIME; } -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* Disable confinement if it is activated. */ if (data->pointer_barrier_active == SDL_TRUE) { X11_ConfineCursorWithFlags(_this, data->window, NULL, X11_BARRIER_HANDLED_BY_EVENT); @@ -1180,7 +1180,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) X11_DispatchUnmapNotify(data); } -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* Disable confinement if the window gets hidden. */ if (data->pointer_barrier_active == SDL_TRUE) { X11_ConfineCursorWithFlags(_this, data->window, NULL, X11_BARRIER_HANDLED_BY_EVENT); @@ -1196,7 +1196,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) #endif X11_DispatchMapNotify(data); -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* Enable confinement if it was activated. */ if (data->pointer_barrier_active == SDL_TRUE) { X11_ConfineCursorWithFlags(_this, data->window, &data->barrier_rect, X11_BARRIER_HANDLED_BY_EVENT); @@ -1738,7 +1738,7 @@ void X11_PumpEvents(_THIS) SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) { X11_XResetScreenSaver(data->display); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_ScreensaverTickle(); #endif @@ -1774,13 +1774,13 @@ void X11_PumpEvents(_THIS) void X11_SuspendScreenSaver(_THIS) { -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; int dummy; int major_version, minor_version; #endif /* SDL_VIDEO_DRIVER_X11_XSCRNSAVER */ -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (SDL_DBus_ScreensaverInhibit(_this->suspend_screensaver)) { return; } @@ -1790,7 +1790,7 @@ void X11_SuspendScreenSaver(_THIS) } #endif -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER if (SDL_X11_HAVE_XSS) { /* X11_XScreenSaverSuspend was introduced in MIT-SCREEN-SAVER 1.1 */ if (!X11_XScreenSaverQueryExtension(data->display, &dummy, &dummy) || diff --git a/src/video/x11/SDL_x11framebuffer.c b/src/video/x11/SDL_x11framebuffer.c index 739c7b342..bc6ed76ee 100644 --- a/src/video/x11/SDL_x11framebuffer.c +++ b/src/video/x11/SDL_x11framebuffer.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_x11framebuffer.h" diff --git a/src/video/x11/SDL_x11keyboard.c b/src/video/x11/SDL_x11keyboard.c index 8d0c6c8c8..b3b05914a 100644 --- a/src/video/x11/SDL_x11keyboard.c +++ b/src/video/x11/SDL_x11keyboard.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_hints.h" #include "SDL_misc.h" @@ -100,7 +100,7 @@ X11_KeyCodeToSym(_THIS, KeyCode keycode, unsigned char group) SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; KeySym keysym; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM if (data->xkb) { int num_groups = XkbKeyNumGroups(data->xkb, keycode); unsigned char info = XkbKeyGroupInfo(data->xkb, keycode); @@ -155,7 +155,7 @@ int X11_InitKeyboard(_THIS) int distance; Bool xkb_repeat = 0; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM { int xkb_major = XkbMajorVersion; int xkb_minor = XkbMinorVersion; @@ -347,7 +347,7 @@ void X11_UpdateKeymap(_THIS, SDL_bool send_event) SDL_GetDefaultKeymap(keymap); -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM if (data->xkb) { XkbStateRec state; X11_XkbGetUpdatedMap(data->display, XkbAllClientInfoMask, data->xkb); @@ -403,7 +403,7 @@ void X11_QuitKeyboard(_THIS) { SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM if (data->xkb) { X11_XkbFreeKeyboard(data->xkb, 0, True); data->xkb = NULL; diff --git a/src/video/x11/SDL_x11messagebox.c b/src/video/x11/SDL_x11messagebox.c index c6dcaeb81..0fcb81b6b 100644 --- a/src/video/x11/SDL_x11messagebox.c +++ b/src/video/x11/SDL_x11messagebox.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL.h" #include "SDL_x11video.h" @@ -84,7 +84,7 @@ typedef struct SDL_MessageBoxDataX11 Display *display; int screen; Window window; -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE XdbeBackBuffer buf; SDL_bool xdbe; /* Whether Xdbe is present or not */ #endif @@ -372,7 +372,7 @@ static void X11_MessageBoxShutdown(SDL_MessageBoxDataX11 *data) data->font_struct = NULL; } -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE if (SDL_X11_HAVE_XDBE && data->xdbe) { X11_XdbeDeallocateBackBufferName(data->display, data->buf); } @@ -499,7 +499,7 @@ static int X11_MessageBoxCreateWindow(SDL_MessageBoxDataX11 *data) X11_XMapRaised(display, data->window); -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE /* Initialise a back buffer for double buffering */ if (SDL_X11_HAVE_XDBE) { int xdbe_major, xdbe_minor; @@ -522,7 +522,7 @@ static void X11_MessageBoxDraw(SDL_MessageBoxDataX11 *data, GC ctx) Drawable window = data->window; Display *display = data->display; -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE if (SDL_X11_HAVE_XDBE && data->xdbe) { window = data->buf; X11_XdbeBeginIdiom(data->display); @@ -577,7 +577,7 @@ static void X11_MessageBoxDraw(SDL_MessageBoxDataX11 *data, GC ctx) } } -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE if (SDL_X11_HAVE_XDBE && data->xdbe) { XdbeSwapInfo swap_info; swap_info.swap_window = data->window; diff --git a/src/video/x11/SDL_x11messagebox.h b/src/video/x11/SDL_x11messagebox.h index 8e4cc0338..33772e0ad 100644 --- a/src/video/x11/SDL_x11messagebox.h +++ b/src/video/x11/SDL_x11messagebox.h @@ -22,7 +22,7 @@ #ifndef SDL_x11messagebox_h_ #define SDL_x11messagebox_h_ -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 extern int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c index 25f2e43c5..c67d470e1 100644 --- a/src/video/x11/SDL_x11modes.c +++ b/src/video/x11/SDL_x11modes.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_hints.h" #include "SDL_x11video.h" @@ -144,7 +144,7 @@ Uint32 X11_GetPixelFormatFromVisualInfo(Display *display, XVisualInfo *vinfo) return SDL_PIXELFORMAT_UNKNOWN; } -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR static SDL_bool CheckXRandR(Display *display, int *major, int *minor) { /* Default the extension not available */ @@ -637,7 +637,7 @@ int X11_InitModes(_THIS) /* XRandR is the One True Modern Way to do this on X11. If this fails, we just won't report any display modes except the current desktop size. */ -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR { SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; int xrandr_major, xrandr_minor; @@ -668,7 +668,7 @@ void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display) mode.format = sdl_display->current_mode.format; mode.driverdata = NULL; -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR if (data->use_xrandr) { Display *display = ((SDL_VideoData *)_this->driverdata)->display; XRRScreenResources *res; @@ -716,7 +716,7 @@ void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display) } } -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR /* This catches an error from XRRSetScreenSize, as a workaround for now. */ /* !!! FIXME: remove this later when we have a better solution. */ static int (*PreXRRSetScreenSizeErrorHandler)(Display *, XErrorEvent *) = NULL; @@ -739,7 +739,7 @@ int X11_SetDisplayMode(_THIS, SDL_VideoDisplay *sdl_display, SDL_DisplayMode *mo viddata->last_mode_change_deadline = SDL_GetTicks() + (PENDING_FOCUS_TIME * 2); -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR if (data->use_xrandr) { Display *display = viddata->display; SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata; diff --git a/src/video/x11/SDL_x11modes.h b/src/video/x11/SDL_x11modes.h index 178c7277c..1b4063489 100644 --- a/src/video/x11/SDL_x11modes.h +++ b/src/video/x11/SDL_x11modes.h @@ -37,14 +37,14 @@ typedef struct SDL_bool use_xrandr; -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR RROutput xrandr_output; #endif } SDL_DisplayData; typedef struct { -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR RRMode xrandr_mode; #else int unused; /* just so struct isn't empty. */ @@ -65,7 +65,7 @@ extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect * extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay *sdl_display, float *ddpi, float *hdpi, float *vdpi); -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR extern void X11_HandleXRandREvent(_THIS, const XEvent *xevent); #endif diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index c3ed9cc21..ea5136061 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include #include "SDL_x11video.h" @@ -80,7 +80,7 @@ static SDL_Cursor *X11_CreateDefaultCursor() return cursor; } -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR static Cursor X11_CreateXCursorCursor(SDL_Surface *surface, int hot_x, int hot_y) { Display *display = GetDisplay(); @@ -204,7 +204,7 @@ static SDL_Cursor *X11_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) if (cursor) { Cursor x11_cursor = None; -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR if (SDL_X11_HAVE_XCURSOR) { x11_cursor = X11_CreateXCursorCursor(surface, hot_x, hot_y); } @@ -328,7 +328,7 @@ static void WarpMouseInternal(Window xwindow, const int x, const int y) { SDL_VideoData *videodata = (SDL_VideoData *)SDL_GetVideoDevice()->driverdata; Display *display = videodata->display; -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 int deviceid = 0; if (X11_Xinput2IsInitialized()) { /* It seems XIWarpPointer() doesn't work correctly on multi-head setups: @@ -354,7 +354,7 @@ static void X11_WarpMouse(SDL_Window *window, int x, int y) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* If we have no barrier, we need to warp */ if (data->pointer_barrier_active == SDL_FALSE) { WarpMouseInternal(data->xwindow, x, y); diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c index 3e95d8d85..057cb1fcd 100644 --- a/src/video/x11/SDL_x11opengl.c +++ b/src/video/x11/SDL_x11opengl.c @@ -21,14 +21,14 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_hints.h" /* GLX implementation of SDL OpenGL support */ -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX #include "SDL_loadso.h" #include "SDL_x11opengles.h" @@ -254,7 +254,7 @@ int X11_GL_LoadLibrary(_THIS, const char *path) if (((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) || SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) && X11_GL_UseEGL(_this) ) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL X11_GL_UnloadLibrary(_this); _this->GL_LoadLibrary = X11_GLES_LoadLibrary; _this->GL_GetProcAddress = X11_GLES_GetProcAddress; diff --git a/src/video/x11/SDL_x11opengl.h b/src/video/x11/SDL_x11opengl.h index a3413982d..c66340237 100644 --- a/src/video/x11/SDL_x11opengl.h +++ b/src/video/x11/SDL_x11opengl.h @@ -23,7 +23,7 @@ #ifndef SDL_x11opengl_h_ #define SDL_x11opengl_h_ -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX #include "SDL_opengl.h" #include diff --git a/src/video/x11/SDL_x11opengles.c b/src/video/x11/SDL_x11opengles.c index 4d38a71e8..e9691037e 100644 --- a/src/video/x11/SDL_x11opengles.c +++ b/src/video/x11/SDL_x11opengles.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_X11) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_hints.h" #include "SDL_x11video.h" @@ -36,7 +36,7 @@ int X11_GLES_LoadLibrary(_THIS, const char *path) /* If the profile requested is not GL ES, switch over to X11_GL functions */ if ((_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) && !SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) { - #if SDL_VIDEO_OPENGL_GLX + #ifdef SDL_VIDEO_OPENGL_GLX X11_GLES_UnloadLibrary(_this); _this->GL_LoadLibrary = X11_GL_LoadLibrary; _this->GL_GetProcAddress = X11_GL_GetProcAddress; diff --git a/src/video/x11/SDL_x11opengles.h b/src/video/x11/SDL_x11opengles.h index cd5bfba0a..6a2affce0 100644 --- a/src/video/x11/SDL_x11opengles.h +++ b/src/video/x11/SDL_x11opengles.h @@ -23,7 +23,7 @@ #ifndef SDL_x11opengles_h_ #define SDL_x11opengles_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c index 9e7ce35aa..2b94e352a 100644 --- a/src/video/x11/SDL_x11shape.c +++ b/src/video/x11/SDL_x11shape.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_x11shape.h" @@ -30,9 +30,9 @@ SDL_WindowShaper *X11_CreateShaper(SDL_Window *window) { SDL_WindowShaper *result = NULL; - SDL_ShapeData *data = NULL; -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE + SDL_ShapeData *data = NULL; if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */ result = SDL_malloc(sizeof(SDL_WindowShaper)); if (!result) { @@ -94,15 +94,17 @@ int X11_ResizeWindowShape(SDL_Window *window) int X11_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode) { +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE SDL_ShapeData *data = NULL; SDL_WindowData *windowdata = NULL; Pixmap shapemask; +#endif if (!shaper || !shape || !shaper->driverdata) { return -1; } -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE if (shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode)) { return -2; } diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h index dcdd580e8..efbd05190 100644 --- a/src/video/x11/SDL_x11sym.h +++ b/src/video/x11/SDL_x11sym.h @@ -156,7 +156,7 @@ SDL_X11_SYM(int,XQueryTree,(Display* a,Window b,Window* c,Window* d,Window** e,u SDL_X11_SYM(Bool,XSupportsLocale,(void),(),return) SDL_X11_SYM(Status,XmbTextListToTextProperty,(Display* a,char** b,int c,XICCEncodingStyle d,XTextProperty* e),(a,b,c,d,e),return) -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES SDL_X11_MODULE(XFIXES) SDL_X11_SYM(PointerBarrier, XFixesCreatePointerBarrier, (Display* a, Window b, int c, int d, int e, int f, int g, int h, int *i),(a,b,c,d,e,f,g,h,i),return) SDL_X11_SYM(void, XFixesDestroyPointerBarrier, (Display* a, PointerBarrier b), (a,b),) @@ -165,12 +165,12 @@ SDL_X11_SYM(Status, XFixesQueryVersion,(Display* a, int* b, int* c), (a,b,c), re SDL_X11_SYM(Status, XFixesSelectSelectionInput, (Display* a, Window b, Atom c, unsigned long d), (a,b,c,d), return) #endif -#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS +#ifdef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS SDL_X11_SYM(Bool,XGetEventData,(Display* a,XGenericEventCookie* b),(a,b),return) SDL_X11_SYM(void,XFreeEventData,(Display* a,XGenericEventCookie* b),(a,b),) #endif -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM SDL_X11_SYM(Bool,XkbQueryExtension,(Display* a,int * b,int * c,int * d,int * e, int *f),(a,b,c,d,e,f),return) #if NeedWidePrototypes SDL_X11_SYM(KeySym,XkbKeycodeToKeysym,(Display* a,unsigned int b,int c,int d),(a,b,c,d),return) @@ -248,7 +248,7 @@ SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a,IPCard b),(a,b),return) #endif /* XCursor support */ -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR SDL_X11_MODULE(XCURSOR) SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),return) SDL_X11_SYM(void,XcursorImageDestroy,(XcursorImage *a),(a),) @@ -256,7 +256,7 @@ SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a, #endif /* Xdbe support */ -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE SDL_X11_MODULE(XDBE) SDL_X11_SYM(Status,XdbeQueryExtension,(Display *dpy,int *major_version_return,int *minor_version_return),(dpy,major_version_return,minor_version_return),return) SDL_X11_SYM(XdbeBackBuffer,XdbeAllocateBackBufferName,(Display *dpy,Window window,XdbeSwapAction swap_action),(dpy,window,swap_action),return) @@ -270,7 +270,7 @@ SDL_X11_SYM(XdbeBackBufferAttributes*,XdbeGetBackBufferAttributes,(Display *dpy, #endif /* XInput2 support for multiple mice, tablets, etc. */ -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 SDL_X11_MODULE(XINPUT2) SDL_X11_SYM(XIDeviceInfo*,XIQueryDevice,(Display *a,int b,int *c),(a,b,c),return) SDL_X11_SYM(void,XIFreeDeviceInfo,(XIDeviceInfo *a),(a),) @@ -284,7 +284,7 @@ SDL_X11_SYM(Bool,XIWarpPointer,(Display *a,int b,Window c,Window d,double e,doub #endif /* XRandR support */ -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR SDL_X11_MODULE(XRANDR) SDL_X11_SYM(Status,XRRQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return) SDL_X11_SYM(Bool,XRRQueryExtension,(Display *dpy,int *event_base_return,int *error_base_return),(dpy,event_base_return,error_base_return),return); @@ -313,14 +313,14 @@ SDL_X11_SYM(void,XRRSelectInput,(Display *dpy, Window window, int mask),(dpy,win #endif /* MIT-SCREEN-SAVER support */ -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER SDL_X11_MODULE(XSS) SDL_X11_SYM(Bool,XScreenSaverQueryExtension,(Display *dpy,int *event_base,int *error_base),(dpy,event_base,error_base),return) SDL_X11_SYM(Status,XScreenSaverQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return) SDL_X11_SYM(void,XScreenSaverSuspend,(Display *dpy,Bool suspend),(dpy,suspend),return) #endif -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE SDL_X11_MODULE(XSHAPE) SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x_off,int y_off,Pixmap src,int op),(dpy,dest,dest_kind,x_off,y_off,src,op),) #endif diff --git a/src/video/x11/SDL_x11touch.c b/src/video/x11/SDL_x11touch.c index 90a41353e..86f1ed40a 100644 --- a/src/video/x11/SDL_x11touch.c +++ b/src/video/x11/SDL_x11touch.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_x11touch.h" diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 5a23ab426..913602698 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include /* For getpid() and readlink() */ @@ -38,7 +38,7 @@ #include "SDL_x11xinput2.h" #include "SDL_x11xfixes.h" -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "SDL_x11opengles.h" #endif @@ -183,7 +183,7 @@ static SDL_VideoDevice *X11_CreateDevice(void) data->global_mouse_changed = SDL_TRUE; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES data->active_cursor_confined_window = NULL; #endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ @@ -261,7 +261,7 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->AcceptDragAndDrop = X11_AcceptDragAndDrop; device->FlashWindow = X11_FlashWindow; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES device->SetWindowMouseRect = X11_SetWindowMouseRect; #endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ @@ -269,7 +269,7 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->shape_driver.SetWindowShape = X11_SetWindowShape; device->shape_driver.ResizeWindowShape = X11_ResizeWindowShape; -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX device->GL_LoadLibrary = X11_GL_LoadLibrary; device->GL_GetProcAddress = X11_GL_GetProcAddress; device->GL_UnloadLibrary = X11_GL_UnloadLibrary; @@ -280,8 +280,8 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->GL_SwapWindow = X11_GL_SwapWindow; device->GL_DeleteContext = X11_GL_DeleteContext; #endif -#if SDL_VIDEO_OPENGL_EGL -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_GLX if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) { #endif device->GL_LoadLibrary = X11_GLES_LoadLibrary; @@ -293,7 +293,7 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->GL_GetSwapInterval = X11_GLES_GetSwapInterval; device->GL_SwapWindow = X11_GLES_SwapWindow; device->GL_DeleteContext = X11_GLES_DeleteContext; -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX } #endif #endif @@ -314,7 +314,7 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->free = X11_DeleteDevice; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = X11_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = X11_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = X11_Vulkan_GetInstanceExtensions; diff --git a/src/video/x11/SDL_x11video.h b/src/video/x11/SDL_x11video.h index 65876c220..8f9313454 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -31,22 +31,22 @@ #include #include -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR #include #endif -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE #include #endif -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 #include #endif -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR #include #endif -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER #include #endif -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE #include #endif @@ -79,7 +79,7 @@ typedef struct SDL_VideoData int windowlistlength; XID window_group; Window clipboard_window; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES SDL_Window *active_cursor_confined_window; #endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ @@ -138,7 +138,7 @@ typedef struct SDL_VideoData int xrandr_event_base; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM XkbDescPtr xkb; #endif int xkb_event; @@ -146,7 +146,7 @@ typedef struct SDL_VideoData KeyCode filter_code; Time filter_time; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN /* Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL */ void *vulkan_xlib_xcb_library; PFN_XGetXCBConnection vulkan_XGetXCBConnection; diff --git a/src/video/x11/SDL_x11vulkan.c b/src/video/x11/SDL_x11vulkan.c index fd31aae6f..de58adc6d 100644 --- a/src/video/x11/SDL_x11vulkan.c +++ b/src/video/x11/SDL_x11vulkan.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11) #include "SDL_x11video.h" diff --git a/src/video/x11/SDL_x11vulkan.h b/src/video/x11/SDL_x11vulkan.h index 775e07de9..405cc629a 100644 --- a/src/video/x11/SDL_x11vulkan.h +++ b/src/video/x11/SDL_x11vulkan.h @@ -25,7 +25,7 @@ #include "../SDL_vulkan_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11) /*typedef struct xcb_connection_t xcb_connection_t;*/ typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy); diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index 5cdf73dae..8397edbfb 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_hints.h" #include "../SDL_sysvideo.h" @@ -35,7 +35,7 @@ #include "SDL_x11xinput2.h" #include "SDL_x11xfixes.h" -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "SDL_x11opengles.h" #endif @@ -391,7 +391,7 @@ int X11_CreateWindow(_THIS, SDL_Window *window) long fevent = 0; const char *hint = NULL; -#if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_OPENGL_GLX) || defined(SDL_VIDEO_OPENGL_EGL) const char *forced_visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_WINDOW_VISUALID); if (forced_visual_id && forced_visual_id[0] != '\0') { @@ -412,10 +412,10 @@ int X11_CreateWindow(_THIS, SDL_Window *window) !SDL_getenv("SDL_VIDEO_X11_VISUALID")) { XVisualInfo *vinfo = NULL; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) || SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX && (!_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { @@ -423,7 +423,7 @@ int X11_CreateWindow(_THIS, SDL_Window *window) } else #endif { -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX vinfo = X11_GL_GetVisual(_this, display, screen); #endif } @@ -634,15 +634,15 @@ int X11_CreateWindow(_THIS, SDL_Window *window) } windowdata = (SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 || SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) || defined(SDL_VIDEO_OPENGL_EGL) if ((window->flags & SDL_WINDOW_OPENGL) && ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) || SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX && (!_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (!_this->egl_data) { return -1; } @@ -1798,7 +1798,7 @@ void X11_DestroyWindow(_THIS, SDL_Window *window) } SDL_free(data); -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* If the pointer barriers are active for this, deactivate it.*/ if (videodata->active_cursor_confined_window == window) { X11_DestroyPointerBarrier(_this, window); diff --git a/src/video/x11/SDL_x11window.h b/src/video/x11/SDL_x11window.h index f31eb403e..52b4db017 100644 --- a/src/video/x11/SDL_x11window.h +++ b/src/video/x11/SDL_x11window.h @@ -29,7 +29,7 @@ */ #define PENDING_FOCUS_TIME 200 -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include #endif @@ -70,10 +70,10 @@ typedef struct Window xdnd_source; SDL_bool flashing_window; Uint32 flash_cancel_time; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES SDL_bool pointer_barrier_active; PointerBarrier barrier[4]; SDL_Rect barrier_rect; diff --git a/src/video/x11/SDL_x11xfixes.c b/src/video/x11/SDL_x11xfixes.c index 2189f231d..c5a04bfeb 100644 --- a/src/video/x11/SDL_x11xfixes.c +++ b/src/video/x11/SDL_x11xfixes.c @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_DRIVER_X11_XFIXES +#if defined(SDL_VIDEO_DRIVER_X11) && defined(SDL_VIDEO_DRIVER_X11_XFIXES) #include "SDL_x11video.h" #include "SDL_x11xfixes.h" diff --git a/src/video/x11/SDL_x11xfixes.h b/src/video/x11/SDL_x11xfixes.h index bba409515..fb6807637 100644 --- a/src/video/x11/SDL_x11xfixes.h +++ b/src/video/x11/SDL_x11xfixes.h @@ -24,7 +24,7 @@ #ifndef SDL_x11xfixes_h_ #define SDL_x11xfixes_h_ -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES #define X11_BARRIER_HANDLED_BY_EVENT 1 diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c index 729269b0e..0c191f7c1 100644 --- a/src/video/x11/SDL_x11xinput2.c +++ b/src/video/x11/SDL_x11xinput2.c @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_x11xinput2.h" @@ -29,10 +29,10 @@ #define MAX_AXIS 16 -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 static int xinput2_initialized = 0; -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH static int xinput2_multitouch_supported = 0; #endif @@ -74,7 +74,7 @@ static SDL_bool xinput2_version_atleast(const int version, const int wantmajor, return version >= ((wantmajor * 1000) + wantminor); } -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH static SDL_Window *xinput2_get_sdlwindow(SDL_VideoData *videodata, Window window) { int i; @@ -112,7 +112,7 @@ static void xinput2_normalize_touch_coordinates(SDL_Window *window, double in_x, void X11_InitXinput2(_THIS) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; int version = 0; @@ -142,7 +142,7 @@ void X11_InitXinput2(_THIS) xinput2_initialized = 1; -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /* Multitouch needs XInput 2.2 */ +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /* Multitouch needs XInput 2.2 */ xinput2_multitouch_supported = xinput2_version_atleast(version, 2, 2); #endif @@ -155,7 +155,7 @@ void X11_InitXinput2(_THIS) XISetMask(mask, XI_RawButtonPress); XISetMask(mask, XI_RawButtonRelease); -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /* Enable raw touch events if supported */ if (X11_Xinput2IsMultitouchSupported()) { XISetMask(mask, XI_RawTouchBegin); @@ -181,7 +181,7 @@ void X11_InitXinput2(_THIS) #endif } -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 /* xi2 device went away? take it out of the list. */ static void xinput2_remove_device_info(SDL_VideoData *videodata, const int device_id) { @@ -266,7 +266,7 @@ static SDL_XInput2DeviceInfo *xinput2_get_device_info(SDL_VideoData *videodata, int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 if (cookie->extension != xinput2_opcode) { return 0; } @@ -321,7 +321,7 @@ int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie case XI_RawButtonPress: case XI_RawButtonRelease: -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH case XI_RawTouchBegin: case XI_RawTouchUpdate: case XI_RawTouchEnd: @@ -329,7 +329,7 @@ int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie videodata->global_mouse_changed = SDL_TRUE; break; -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /* With multitouch, register to receive XI_Motion (which desctivates MotionNotify), * so that we can distinguish real mouse motions from synthetic one. */ case XI_Motion: @@ -385,7 +385,7 @@ int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie void X11_InitXinput2Multitouch(_THIS) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; XIDeviceInfo *info; int ndevices, i, j; @@ -425,7 +425,7 @@ void X11_InitXinput2Multitouch(_THIS) void X11_Xinput2SelectTouch(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_VideoData *data = NULL; XIEventMask eventmask; unsigned char mask[4] = { 0, 0, 0, 0 }; @@ -453,7 +453,7 @@ void X11_Xinput2SelectTouch(_THIS, SDL_Window *window) int X11_Xinput2IsInitialized() { -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 return xinput2_initialized; #else return 0; @@ -462,7 +462,7 @@ int X11_Xinput2IsInitialized() int X11_Xinput2IsMultitouchSupported() { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH return xinput2_initialized && xinput2_multitouch_supported; #else return 0; @@ -471,7 +471,7 @@ int X11_Xinput2IsMultitouchSupported() void X11_Xinput2GrabTouch(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_WindowData *data = (SDL_WindowData *)window->driverdata; Display *display = data->videodata->display; @@ -501,7 +501,7 @@ void X11_Xinput2GrabTouch(_THIS, SDL_Window *window) void X11_Xinput2UngrabTouch(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_WindowData *data = (SDL_WindowData *)window->driverdata; Display *display = data->videodata->display; diff --git a/test/checkkeys.c b/test/checkkeys.c index d4e15846d..c5059b75e 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -284,7 +284,7 @@ int main(int argc, char *argv[]) textwin = SDLTest_TextWindowCreate(0, 0, 640, 480); -#if __IPHONEOS__ +#ifdef __IPHONEOS__ /* Creating the context creates the view, which we need to show keyboard */ SDL_GL_CreateContext(window); #endif diff --git a/test/checkkeysthreads.c b/test/checkkeysthreads.c index 22983b157..8afc46d62 100644 --- a/test/checkkeysthreads.c +++ b/test/checkkeysthreads.c @@ -266,7 +266,7 @@ int main(int argc, char *argv[]) renderer = SDL_CreateRenderer(window, -1, 0); SDL_RenderPresent(renderer); -#if __IPHONEOS__ +#ifdef __IPHONEOS__ /* Creating the context creates the view, which we need to show keyboard */ SDL_GL_CreateContext(window); #endif diff --git a/test/loopwavequeue.c b/test/loopwavequeue.c index d7e7d408a..a5f039ae2 100644 --- a/test/loopwavequeue.c +++ b/test/loopwavequeue.c @@ -21,7 +21,7 @@ #include "SDL.h" -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H #include #endif @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) wave.spec.callback = NULL; /* we'll push audio. */ -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H /* Set the signals */ #ifdef SIGHUP (void)signal(SIGHUP, poked); diff --git a/test/testaudiohotplug.c b/test/testaudiohotplug.c index 35e65a99c..2a8e01737 100644 --- a/test/testaudiohotplug.c +++ b/test/testaudiohotplug.c @@ -17,7 +17,7 @@ #include #include -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H #include #endif @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) quit(1); } -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H /* Set the signals */ #ifdef SIGHUP (void)signal(SIGHUP, poked); diff --git a/test/testautomation_keyboard.c b/test/testautomation_keyboard.c index 0d459d0b2..153a4a051 100644 --- a/test/testautomation_keyboard.c +++ b/test/testautomation_keyboard.c @@ -464,7 +464,7 @@ int keyboard_setTextInputRect(void *arg) int keyboard_setTextInputRectNegative(void *arg) { /* Some platforms set also an error message; prepare for checking it */ -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_COCOA +#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_ANDROID) || defined(SDL_VIDEO_DRIVER_COCOA) const char *expectedError = "Parameter 'rect' is invalid"; const char *error; @@ -477,7 +477,7 @@ int keyboard_setTextInputRectNegative(void *arg) SDLTest_AssertPass("Call to SDL_SetTextInputRect(NULL)"); /* Some platforms set also an error message; so check it */ -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_COCOA +#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_ANDROID) || defined(SDL_VIDEO_DRIVER_COCOA) error = SDL_GetError(); SDLTest_AssertPass("Call to SDL_GetError()"); SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL"); diff --git a/test/testevdev.c b/test/testevdev.c index e61579158..060ec1176 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -18,7 +18,7 @@ static int run_test(void); -#if HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX) +#if defined(HAVE_LIBUDEV_H) || defined(SDL_JOYSTICK_LINUX) #include diff --git a/test/testgl2.c b/test/testgl2.c index 1d34d4c1c..7ae37743e 100644 --- a/test/testgl2.c +++ b/test/testgl2.c @@ -40,11 +40,11 @@ static GL_Context ctx; static int LoadContext(GL_Context *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif diff --git a/test/testgles2.c b/test/testgles2.c index 82740fa0f..59ea43d4a 100644 --- a/test/testgles2.c +++ b/test/testgles2.c @@ -65,11 +65,11 @@ static GLES2_Context ctx; static int LoadContext(GLES2_Context *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif @@ -893,9 +893,9 @@ int main(int argc, char *argv[]) SDL_Log("%2.2f frames per second\n", ((double)frames * 1000) / (now - then)); } -#if !defined(__ANDROID__) && !defined(__NACL__) +#if !defined(__ANDROID__) && !defined(__NACL__) quit(0); -#endif +#endif return 0; } diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c index 534405f1a..ab885c56c 100644 --- a/test/testgles2_sdf.c +++ b/test/testgles2_sdf.c @@ -63,11 +63,11 @@ static GLES2_Context ctx; static int LoadContext(GLES2_Context *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif diff --git a/test/testime.c b/test/testime.c index 00b63c6f1..9b2e4bd56 100644 --- a/test/testime.c +++ b/test/testime.c @@ -29,7 +29,7 @@ #ifdef HAVE_SDL_TTF #ifdef __MACOSX__ #define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" -#elif __WIN32__ +#elif defined(__WIN32__) /* Some japanese font present on at least Windows 8.1. */ #define DEFAULT_FONT "C:\\Windows\\Fonts\\yugothic.ttf" #else