From 3472dc11d6f7d22055d185724853c4dfcc0e3967 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 29 Mar 2023 21:49:01 +0000 Subject: [PATCH] Fix uses of undefined macro identifiers (-Wundef) * Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINDOWS * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_ANDROID * Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DUMMY * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_COCOA * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_UIKIT * Fix -Wundef warnings due to use of unguarded SDL_TIMERS_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_EVENTS_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_TIMER_DUMMY * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_SENSOR_DISABLED * Fix -Wundef warnings due to use of unguarded __ANDROID__ * Fix -Wundef warnings due to use of unguarded __IOS__ * Fix -Wundef warnings due to use of unguarded EMULATE_CAS * Fix -Wundef warnings due to use of unguarded SDL_ATOMIC_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_THREADS_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_SNDIO * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_NETBSD * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_WASAPI * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DSOUND * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_HAIKU * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_COREAUDIO * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_AAUDIO * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OPENSLES * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ANDROID * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PS2 * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PSP * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_VITA * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_N3DS * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_EMSCRIPTEN * Fix -Wundef warnings due to use of unguarded SDL_NEON_INTRINSICS * Fix -Wundef warnings due to use of unguarded SDL_ALTIVEC_BLITTERS * Fix -Wundef warnings due to use of unguarded __VITA__ * Fix -Wundef warnings due to use of unguarded __3DS__ * Fix -Wundef warnings due to use of unguarded SDL_DYNAPI_PROC_NO_VARARGS * Fix -Wundef warnings due to use of unguarded __APPLE__ * Fix -Wundef warnings due to use of unguarded __WINRT__ * Fix -Wundef warnings due to use of unguarded SDL_HIDAPI_DISABLED * Fix -Wundef warnings due to use of unguarded __TVOS__ * Fix -Wundef warnings due to use of unguarded HAVE_DRIVER_BACKEND * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_XINPUT * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_WGI * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DINPUT * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_MFI * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_EMSCRIPTEN * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PS2 * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PSP * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VITA * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_N3DS * Fix -Wundef warnings due to use of unguarded __MACOS__ * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINRT * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RPI * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR_OGL * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D11 * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D12 * Fix -Wundef warnings due to use of unguarded SDL_RENDER_DISABLED * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_METAL * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PS2 * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PSP * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_VITA_GXM * Fix -Wundef warnings due to use of unguarded SDL_ARM_SIMD_BLITTERS * Fix -Wundef warnings due to use of unguarded SDL_ARM_NEON_BLITTERS * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_HAIKU * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PS2 * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PSP * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VITA * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_N3DS * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_KMSDRM * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_EMSCRIPTEN * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_NGAGE * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_METAL * Fix -Wundef warnings due to use of unguarded SDL_LSX_INTRINSICS * Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_NP_H * Fix -Wundef warnings due to use of unguarded __RISCOS__ * Fix -Wundef warnings due to use of unguarded FAKE_RECURSIVE_MUTEX * Fix -Wundef warnings due to use of unguarded USE_POSIX_SPAWN * textureData is only needed when SDL is built with YUV support * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ALSA * Fix -Wundef warnings due to use of unguarded SDL_SSE3_INTRINSICS * Fix -Wundef warnings due to use of unguarded SDL_SSE4_2_INTRINSICS * Fix -Wundef warnings due to use of unguarded SDL_SSE4_1_INTRINSICS * Fix -Wundef warnings due to use of unguarded SDL_AVX512F_INTRINSICS * Fix -Wundef warnings due to use of unguarded SDL_SSE2_INTRINSICS * Fix -Wundef warnings due to use of unguarded SDL_AVX_INTRINSICS * Fix -Wundef warnings due to use of unguarded SDL_AVX2_INTRINSICS * Fix -Wundef warnings due to use of unguarded SDL_SSE_INTRINSICS * Fix -Wundef warnings due to use of unguarded SDL_MMX_INTRINSICS * Fix -Wundef warnings due to use of unguarded HAVE_CLOCK_GETTIME * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DUMMY * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_DUMMY * Fix -Wundef warnings due to use of unguarded HAVE_GCC_ATOMICS * Fix -Wundef warnings due to use of unguarded HAVE_GCC_SYNC_LOCK_TEST_AND_SET * Fix -Wundef warnings due to use of unguarded SDL_USE_LIBDBUS * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_JACK * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VIRTUAL * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_LINUX * Fix -Wundef warnings due to use of unguarded HAVE_LIBC * Fix -Wundef warnings due to disabling SDL_LIBC * Fix -Wundef warnings due to use of unguarded HAVE_PLATFORM_BACKEND * Fix -Wundef warnings due to use of unguarded DEBUG * Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H * Fix -Werror=unused-variable when building with SDL_LIBC=OFF * Fix -Wundef warnings due to use of unguqrded SDL_USE_LIBUDEV * Use SDL alloc functions in libusb/hid.c * Fix -Wundef warnings due to use of unguarded HAVE_LIBUDEV_H * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_OFFSCREEN * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_GLX * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2 * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL_ES2 * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OSS * Remove SDL_AUDIO_DRIVER_SUNAUDIO reference since it is never set * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PIPEWIRE * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PULSEAUDIO * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XCURSOR * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XDBE * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XFIXES * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XINPUT2 * Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH * Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XRANDR * Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XSCRNSAVER * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XSHAPE * Don't call XShape functions when XShape is diabled * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND * Fix -Wundef warnings due to use of unuarded SDL_VIDEO_DRIVER_X11 * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL * Disable array when compiled with SDL_EVENTS=OFF * Fix -Wundef warnings due to use of unguarded SDL_INPUT_LINUXEV * Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD * Fix -Wundef warnings due to use of unguarded SDL_THREAD_WINDOWS * Fix -Wundef warnings due to use of unguarded SDL_THREAD_PS2 * Fix -Wundef warnings due to use of unguarded SDL_THREAD_PSP * Fix -Wundef warnings due to use of unguarded SDL_THREAD_VITA * Fix -Wundef warnings due to use of unguarded SDL_THREAD_N3DS * Fix -Wundef warnings due to use of unguarded SDL_THREAD_STDCPP * Fix -Wundef warnings due to use of unguarded SDL_THREAD_NGAGE * Fix -Wundef warnings due to use of unguarded __WINDOWS__ * Fix -Wundef warnings due to use of unguarded __WINGDK__ * Fix -Wundef warnings due to use of unguarded __ANDROID__ * Fix -Wundef warnings due to use of unguarded SDL_THREAD_GENERIC_COND_SUFFIX * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PIB * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR * Fix -Wundef warnings due to use of unguarded SDL_FILE_DISABLED * Fix -Wundef warnings due to use of unguarded __XBOXONE__ * Fix -Wundef warnings due to use of unguarded __XBOXSERIES__ * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_WGL * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_QNX * Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_QNX * Fix -Wundef warnings due to use of unguarded DEBUG_RAZOR * Fix -Wundef warnings due to use of unguarded WINAPI_FAMILY_PHONE_APP * Fix -Wundef warnings due to use of unguarded SDL_MAC_NO_SANDBOX * Fix -Wundef warnings due to use of unguarded __(IPHONE|APPLETV|MAC)_OS_VERSION_MAX_ALLOWED * Fix C4090 warning ('function': different 'const' qualifiers) * ci: use -isystem for include dirs of pspdev toolchain * cmake: add -Wundef option * Fix remaining -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN and SDL_VIDEO_METAL * Fix -Wundef warnings due to use of unguarded __MACOS__ * DEBUG_CONVERT is guaranteed to be defined in src/audio/SDL_audiocvt.c * Fix -Wundef warnings due to use of unguarded HAVE_NANOSLEEP * Fix -Wundef warnings due to use of unguarded HAVE_DXGI_H * Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H * fix SDL_VIDEO_DRIVER_WAYLAND * fix SDL_VIDEO_DRIVER_X11 * Fix -Wundef warnings due to use of unguarded HAVE_MMDEVICEAPI_H * Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SETNAME_NP * Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SET_NAME_NP * Fix -Wundef warnings due to use of unguarded HAVE_SETJMP * Fix -Wundef warnings due to use of unguarded HAVE_SIGNAL_H * Fix -Wundef warnings due to use of unguarded HAVE_TPCSHRD_H * Fix -Wundef warnings due to use of unguarded MACOSX_COREAUDIO * Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DINPUT * Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_IOKIT * Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_XINPUT * Fix -Wundef warnings due to use of unguarded SDL_IPHONE_KEYBOARD * Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_RAWINPUT * Fix -Wundef warnings due to use of unguarded SDL_POWER_ANDROID * Fix -Wundef warnings due to use of unguarded SDL_POWER_EMSCRIPTEN * Fix -Wundef warnings due to use of unguarded SDL_POWER_HAIKU * Fix -Wundef warnings due to use of unguarded SDL_POWER_LINUX * Fix -Wundef warnings due to use of unguarded SDL_POWER_MACOSX * Fix -Wundef warnings due to use of unguarded SDL_POWER_PSP * Fix -Wundef warnings due to use of unguarded SDL_POWER_UIKIT * Fix -Wundef warnings due to use of unguarded SDL_POWER_VITA * Fix -Wundef warnings due to use of unguarded SDL_POWER_WINDOWS * Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX * Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE_VDK * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_CGL * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL * Fix -Wundef warnings due to use of unguarded __MACOS__ * Fix -Wundef warnings due to use of unguarded __OpenBSD__ * Fix -Wundef warnings due to use of unguarded __FreeBSD__ * Fix -Wundef warnings due to use of unguarded __MWERKS__ * Fix -Wundef warnings due to use of unguarded __WIN32__ * Fix -Wundef warnings due to use of unguarded SDL_IPHONE_LAUNCHSCREEN * Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2 * Remove unused HAVE_CONST, HAVE_INLINE and HAVE_VOLATILE * Revert "Use SDL alloc functions in libusb/hid.c" This reverts commit 847c64b00da12ca08bef9e947eb948e378eeaef8. * Handle FAKE_RECURSIVE_MUTEX in similar way as SDL2 * Don't use defined in macro --- .github/workflows/psp.yml | 4 + CMakeLists.txt | 16 +- cmake/sdlchecks.cmake | 3 +- include/SDL3/SDL_platform_defines.h | 6 + include/build_config/SDL_build_config.h.cmake | 7 +- include/build_config/SDL_build_config_winrt.h | 8 +- src/SDL.c | 50 +++--- src/SDL_log.c | 4 +- src/atomic/SDL_atomic.c | 6 +- src/atomic/SDL_spinlock.c | 6 +- src/audio/SDL_audio.c | 54 +++--- src/audio/SDL_audiocvt.c | 12 +- src/audio/SDL_audiodev.c | 2 +- src/audio/SDL_audiotypecvt.c | 19 +-- src/audio/aaudio/SDL_aaudio.c | 2 +- src/audio/alsa/SDL_alsa_audio.c | 2 +- src/audio/android/SDL_androidaudio.c | 2 +- src/audio/coreaudio/SDL_coreaudio.h | 8 +- src/audio/coreaudio/SDL_coreaudio.m | 32 ++-- src/audio/directsound/SDL_directsound.c | 16 +- src/audio/disk/SDL_diskaudio.c | 4 +- src/audio/dsp/SDL_dspaudio.c | 2 +- src/audio/emscripten/SDL_emscriptenaudio.c | 2 +- src/audio/haiku/SDL_haikuaudio.cc | 2 +- src/audio/jack/SDL_jackaudio.c | 2 +- src/audio/netbsd/SDL_netbsdaudio.c | 2 +- src/audio/openslES/SDL_openslES.c | 2 +- src/audio/pipewire/SDL_pipewire.c | 2 +- src/audio/psp/SDL_pspaudio.c | 2 +- src/audio/pulseaudio/SDL_pulseaudio.c | 2 +- src/audio/qnx/SDL_qsa_audio.c | 2 +- src/audio/sndio/SDL_sndioaudio.c | 4 +- src/audio/vita/SDL_vitaaudio.c | 2 +- src/audio/wasapi/SDL_wasapi.c | 2 +- src/audio/wasapi/SDL_wasapi_win32.c | 2 +- src/audio/wasapi/SDL_wasapi_winrt.cpp | 2 +- src/core/android/SDL_android.c | 4 +- src/core/haiku/SDL_BApp.h | 8 +- src/core/linux/SDL_dbus.c | 2 +- src/core/linux/SDL_evdev.c | 10 +- src/core/linux/SDL_evdev_capabilities.c | 2 +- src/core/linux/SDL_evdev_capabilities.h | 2 +- src/core/linux/SDL_ibus.c | 5 + src/core/linux/SDL_threadprio.c | 12 +- src/core/linux/SDL_udev.h | 2 +- src/core/winrt/SDL_winrtapp_direct3d.cpp | 20 +-- src/core/winrt/SDL_winrtapp_direct3d.h | 2 +- src/core/winrt/SDL_winrtapp_xaml.cpp | 4 +- src/cpuinfo/SDL_cpuinfo.c | 10 +- src/dynapi/SDL_dynapi.c | 5 +- src/dynapi/SDL_dynapi_procs.h | 2 +- src/events/SDL_events.c | 28 ++-- src/events/SDL_keysym_to_scancode.c | 2 +- src/events/SDL_quit.c | 4 +- src/events/SDL_scancode_tables.c | 2 +- src/events/imKStoUCS.c | 2 +- src/file/SDL_rwops.c | 8 +- src/filesystem/winrt/SDL_sysfilesystem.cpp | 2 +- src/haptic/linux/SDL_syshaptic.c | 10 +- src/haptic/windows/SDL_dinputhaptic.c | 2 +- src/haptic/windows/SDL_windowshaptic.c | 8 +- src/haptic/windows/SDL_windowshaptic_c.h | 10 +- src/haptic/windows/SDL_xinputhaptic.c | 2 +- src/hidapi/SDL_hidapi.c | 58 +++---- src/hidapi/android/hid.cpp | 6 +- src/hidapi/hidapi/hidapi.h | 2 +- src/hidapi/ios/hid.m | 62 +++---- src/joystick/SDL_gamepad.c | 14 +- src/joystick/SDL_gamepad_db.h | 20 +-- src/joystick/SDL_joystick.c | 42 ++--- src/joystick/apple/SDL_mfijoystick.m | 16 +- src/joystick/darwin/SDL_iokitjoystick.c | 4 +- src/joystick/linux/SDL_sysjoystick.c | 10 +- src/joystick/ps2/SDL_sysjoystick.c | 2 +- src/joystick/psp/SDL_sysjoystick.c | 2 +- src/joystick/virtual/SDL_virtualjoystick_c.h | 2 +- src/joystick/vita/SDL_sysjoystick.c | 2 +- src/joystick/windows/SDL_dinputjoystick.c | 2 +- src/joystick/windows/SDL_rawinputjoystick.c | 2 +- src/joystick/windows/SDL_windowsjoystick.c | 22 +-- src/joystick/windows/SDL_windowsjoystick_c.h | 4 +- src/joystick/windows/SDL_xinputjoystick.c | 2 +- src/loadso/dlopen/SDL_sysloadso.c | 4 +- src/locale/winrt/SDL_syslocale.c | 2 +- src/misc/unix/SDL_sysurl.c | 4 +- src/power/android/SDL_syspower.c | 2 +- src/power/emscripten/SDL_syspower.c | 2 +- src/power/haiku/SDL_syspower.c | 2 +- src/power/linux/SDL_syspower.c | 6 +- src/power/macos/SDL_syspower.c | 2 +- src/power/psp/SDL_syspower.c | 2 +- src/power/uikit/SDL_syspower.h | 2 +- src/power/uikit/SDL_syspower.m | 2 +- src/power/vita/SDL_syspower.c | 2 +- src/power/windows/SDL_syspower.c | 2 +- src/render/SDL_d3dmath.c | 4 +- src/render/SDL_d3dmath.h | 4 +- src/render/SDL_render.c | 30 ++-- src/render/direct3d/SDL_render_d3d.c | 6 +- src/render/direct3d/SDL_shaders_d3d.c | 2 +- src/render/direct3d11/SDL_render_d3d11.c | 16 +- src/render/direct3d11/SDL_render_winrt.cpp | 6 +- src/render/direct3d11/SDL_render_winrt.h | 2 +- src/render/direct3d11/SDL_shaders_d3d11.c | 4 +- src/render/direct3d12/SDL_render_d3d12.c | 4 +- .../direct3d12/SDL_render_d3d12_xbox.cpp | 2 +- src/render/direct3d12/SDL_shaders_d3d12.c | 2 +- .../direct3d12/SDL_shaders_d3d12_xboxone.cpp | 2 +- .../SDL_shaders_d3d12_xboxseries.cpp | 2 +- src/render/metal/SDL_render_metal.m | 2 +- src/render/opengl/SDL_render_gl.c | 6 +- src/render/opengl/SDL_shaders_gl.c | 2 +- src/render/opengles2/SDL_render_gles2.c | 10 +- src/render/opengles2/SDL_shaders_gles2.c | 2 +- src/render/opengles2/SDL_shaders_gles2.h | 2 +- src/render/ps2/SDL_render_ps2.c | 2 +- src/render/psp/SDL_render_psp.c | 2 +- src/render/software/SDL_blendfillrect.c | 2 +- src/render/software/SDL_blendline.c | 2 +- src/render/software/SDL_blendpoint.c | 2 +- src/render/software/SDL_drawline.c | 2 +- src/render/software/SDL_drawpoint.c | 2 +- src/render/software/SDL_render_sw.c | 2 +- src/render/software/SDL_rotate.c | 2 +- src/render/software/SDL_triangle.c | 2 +- src/render/vitagxm/SDL_render_vita_gxm.c | 8 +- .../vitagxm/SDL_render_vita_gxm_memory.c | 2 +- .../vitagxm/SDL_render_vita_gxm_tools.c | 2 +- src/sensor/SDL_sensor.c | 8 +- src/stdlib/SDL_malloc.c | 20 +-- src/test/SDL_test_common.c | 4 +- src/thread/SDL_thread.c | 8 +- src/thread/SDL_thread_c.h | 18 +- src/thread/generic/SDL_syscond.c | 2 +- src/thread/generic/SDL_syscond_c.h | 2 +- src/thread/generic/SDL_sysmutex.c | 8 +- src/thread/generic/SDL_syssem.c | 2 +- src/thread/ngage/SDL_systhread.cpp | 2 +- src/thread/ps2/SDL_syssem.c | 2 +- src/thread/ps2/SDL_systhread.c | 2 +- src/thread/psp/SDL_syscond.c | 2 +- src/thread/psp/SDL_sysmutex.c | 8 +- src/thread/psp/SDL_syssem.c | 2 +- src/thread/psp/SDL_systhread.c | 2 +- src/thread/pthread/SDL_sysmutex.c | 23 +-- src/thread/pthread/SDL_systhread.c | 10 +- src/thread/vita/SDL_syscond.c | 2 +- src/thread/vita/SDL_sysmutex.c | 8 +- src/thread/vita/SDL_syssem.c | 2 +- src/thread/vita/SDL_systhread.c | 2 +- src/thread/windows/SDL_syscond_cv.c | 4 +- src/thread/windows/SDL_sysmutex.c | 8 +- src/thread/windows/SDL_syssem.c | 14 +- src/thread/windows/SDL_systhread.c | 2 +- src/thread/windows/SDL_systls.c | 2 +- src/timer/SDL_timer.c | 2 +- src/timer/unix/SDL_systimer.c | 16 +- src/video/SDL_blit_A.c | 26 +-- src/video/SDL_blit_N.c | 16 +- src/video/SDL_blit_copy.c | 8 +- src/video/SDL_egl.c | 40 ++--- src/video/SDL_egl_c.h | 2 +- src/video/SDL_fillrect.c | 16 +- src/video/SDL_stretch.c | 4 +- src/video/SDL_sysvideo.h | 4 +- src/video/SDL_video.c | 154 +++++++++--------- src/video/SDL_vulkan_internal.h | 16 +- src/video/SDL_vulkan_utils.c | 2 +- src/video/SDL_yuv.c | 44 ++--- src/video/android/SDL_androidclipboard.c | 2 +- src/video/android/SDL_androidevents.c | 18 +- src/video/android/SDL_androidgl.c | 2 +- src/video/android/SDL_androidkeyboard.c | 2 +- src/video/android/SDL_androidmessagebox.c | 2 +- src/video/android/SDL_androidmessagebox.h | 2 +- src/video/android/SDL_androidmouse.c | 2 +- src/video/android/SDL_androidtouch.c | 2 +- src/video/android/SDL_androidvideo.c | 6 +- src/video/android/SDL_androidvulkan.c | 2 +- src/video/android/SDL_androidvulkan.h | 2 +- src/video/android/SDL_androidwindow.c | 8 +- src/video/android/SDL_androidwindow.h | 2 +- src/video/cocoa/SDL_cocoaclipboard.m | 2 +- src/video/cocoa/SDL_cocoaevents.m | 14 +- src/video/cocoa/SDL_cocoakeyboard.m | 4 +- src/video/cocoa/SDL_cocoamessagebox.h | 2 +- src/video/cocoa/SDL_cocoamessagebox.m | 2 +- src/video/cocoa/SDL_cocoametalview.h | 2 +- src/video/cocoa/SDL_cocoametalview.m | 2 +- src/video/cocoa/SDL_cocoamodes.m | 2 +- src/video/cocoa/SDL_cocoamouse.m | 2 +- src/video/cocoa/SDL_cocoaopengl.h | 2 +- src/video/cocoa/SDL_cocoaopengl.m | 4 +- src/video/cocoa/SDL_cocoaopengles.h | 2 +- src/video/cocoa/SDL_cocoaopengles.m | 6 +- src/video/cocoa/SDL_cocoashape.m | 2 +- src/video/cocoa/SDL_cocoavideo.m | 14 +- src/video/cocoa/SDL_cocoavulkan.h | 2 +- src/video/cocoa/SDL_cocoavulkan.m | 2 +- src/video/cocoa/SDL_cocoawindow.h | 4 +- src/video/cocoa/SDL_cocoawindow.m | 18 +- src/video/dummy/SDL_nullevents.c | 2 +- src/video/dummy/SDL_nullframebuffer.c | 2 +- src/video/dummy/SDL_nullvideo.c | 14 +- src/video/emscripten/SDL_emscriptenevents.c | 2 +- .../emscripten/SDL_emscriptenframebuffer.c | 2 +- src/video/emscripten/SDL_emscriptenmouse.c | 2 +- src/video/emscripten/SDL_emscriptenopengles.c | 2 +- src/video/emscripten/SDL_emscriptenopengles.h | 2 +- src/video/emscripten/SDL_emscriptenvideo.c | 2 +- src/video/haiku/SDL_BApp.h | 8 +- src/video/haiku/SDL_BWin.h | 12 +- src/video/haiku/SDL_bclipboard.cc | 12 +- src/video/haiku/SDL_bevents.cc | 2 +- src/video/haiku/SDL_bframebuffer.cc | 2 +- src/video/haiku/SDL_bkeyboard.cc | 2 +- src/video/haiku/SDL_bmessagebox.cc | 2 +- src/video/haiku/SDL_bmessagebox.h | 2 +- src/video/haiku/SDL_bmodes.cc | 6 +- src/video/haiku/SDL_bopengl.cc | 2 +- src/video/haiku/SDL_bopengl.h | 2 +- src/video/haiku/SDL_bvideo.cc | 6 +- src/video/haiku/SDL_bwindow.cc | 2 +- src/video/kmsdrm/SDL_kmsdrmdyn.c | 2 +- src/video/kmsdrm/SDL_kmsdrmevents.c | 2 +- src/video/kmsdrm/SDL_kmsdrmmouse.c | 2 +- src/video/kmsdrm/SDL_kmsdrmopengles.c | 2 +- src/video/kmsdrm/SDL_kmsdrmopengles.h | 2 +- src/video/kmsdrm/SDL_kmsdrmvideo.c | 4 +- src/video/kmsdrm/SDL_kmsdrmvulkan.c | 2 +- src/video/kmsdrm/SDL_kmsdrmvulkan.h | 2 +- src/video/ngage/SDL_ngageevents.cpp | 2 +- src/video/ngage/SDL_ngageframebuffer.cpp | 2 +- src/video/ngage/SDL_ngagevideo.cpp | 2 +- src/video/ngage/SDL_ngagewindow.cpp | 2 +- src/video/offscreen/SDL_offscreenevents.c | 2 +- .../offscreen/SDL_offscreenframebuffer.c | 2 +- src/video/offscreen/SDL_offscreenopengles.c | 2 +- src/video/offscreen/SDL_offscreenopengles.h | 2 +- src/video/offscreen/SDL_offscreenvideo.c | 4 +- src/video/offscreen/SDL_offscreenwindow.c | 6 +- src/video/offscreen/SDL_offscreenwindow.h | 2 +- src/video/ps2/SDL_ps2video.c | 2 +- src/video/psp/SDL_pspevents.c | 2 +- src/video/psp/SDL_pspgl.c | 2 +- src/video/psp/SDL_pspmouse.c | 2 +- src/video/psp/SDL_pspvideo.c | 2 +- src/video/raspberry/SDL_rpievents.c | 2 +- src/video/raspberry/SDL_rpimouse.c | 2 +- src/video/raspberry/SDL_rpiopengles.c | 2 +- src/video/raspberry/SDL_rpiopengles.h | 2 +- src/video/raspberry/SDL_rpivideo.c | 4 +- src/video/raspberry/SDL_rpivideo.h | 2 +- src/video/riscos/SDL_riscosevents.c | 2 +- src/video/riscos/SDL_riscosframebuffer.c | 2 +- src/video/riscos/SDL_riscosmessagebox.c | 2 +- src/video/riscos/SDL_riscosmessagebox.h | 2 +- src/video/riscos/SDL_riscosmodes.c | 2 +- src/video/riscos/SDL_riscosmouse.c | 2 +- src/video/riscos/SDL_riscosvideo.c | 2 +- src/video/riscos/SDL_riscoswindow.c | 2 +- src/video/uikit/SDL_uikitappdelegate.m | 4 +- src/video/uikit/SDL_uikitclipboard.m | 2 +- src/video/uikit/SDL_uikitevents.m | 4 +- src/video/uikit/SDL_uikitmessagebox.h | 2 +- src/video/uikit/SDL_uikitmessagebox.m | 2 +- src/video/uikit/SDL_uikitmetalview.h | 2 +- src/video/uikit/SDL_uikitmetalview.m | 2 +- src/video/uikit/SDL_uikitmodes.m | 2 +- src/video/uikit/SDL_uikitopengles.h | 2 +- src/video/uikit/SDL_uikitopengles.m | 4 +- src/video/uikit/SDL_uikitopenglview.h | 2 +- src/video/uikit/SDL_uikitopenglview.m | 2 +- src/video/uikit/SDL_uikitvideo.m | 10 +- src/video/uikit/SDL_uikitview.m | 8 +- src/video/uikit/SDL_uikitviewcontroller.h | 6 +- src/video/uikit/SDL_uikitviewcontroller.m | 14 +- src/video/uikit/SDL_uikitvulkan.h | 2 +- src/video/uikit/SDL_uikitvulkan.m | 2 +- src/video/uikit/SDL_uikitwindow.m | 4 +- src/video/vita/SDL_vitaframebuffer.c | 2 +- src/video/vita/SDL_vitagl_pvr.c | 2 +- src/video/vita/SDL_vitagles.c | 2 +- src/video/vita/SDL_vitagles_pvr.c | 2 +- src/video/vita/SDL_vitakeyboard.c | 2 +- src/video/vita/SDL_vitamessagebox.c | 6 +- src/video/vita/SDL_vitamessagebox.h | 2 +- src/video/vita/SDL_vitamouse.c | 2 +- src/video/vita/SDL_vitatouch.c | 2 +- src/video/vita/SDL_vitavideo.c | 6 +- src/video/vita/SDL_vitavideo.h | 2 +- src/video/vivante/SDL_vivanteopengles.c | 2 +- src/video/vivante/SDL_vivanteopengles.h | 2 +- src/video/vivante/SDL_vivanteplatform.c | 2 +- src/video/vivante/SDL_vivanteplatform.h | 2 +- src/video/vivante/SDL_vivantevideo.c | 26 +-- src/video/vivante/SDL_vivantevideo.h | 4 +- src/video/vivante/SDL_vivantevulkan.c | 2 +- src/video/vivante/SDL_vivantevulkan.h | 2 +- src/video/wayland/SDL_waylandclipboard.c | 2 +- src/video/wayland/SDL_waylanddatamanager.c | 6 +- src/video/wayland/SDL_waylanddyn.c | 2 +- src/video/wayland/SDL_waylandevents.c | 2 +- src/video/wayland/SDL_waylandmessagebox.c | 2 +- src/video/wayland/SDL_waylandmessagebox.h | 2 +- src/video/wayland/SDL_waylandmouse.c | 6 +- src/video/wayland/SDL_waylandmouse.h | 2 +- src/video/wayland/SDL_waylandopengles.c | 2 +- src/video/wayland/SDL_waylandvideo.c | 6 +- src/video/wayland/SDL_waylandvulkan.c | 2 +- src/video/wayland/SDL_waylandvulkan.h | 2 +- src/video/wayland/SDL_waylandwindow.c | 8 +- src/video/wayland/SDL_waylandwindow.h | 2 +- src/video/windows/SDL_windowsclipboard.c | 2 +- src/video/windows/SDL_windowsevents.c | 6 +- src/video/windows/SDL_windowsframebuffer.c | 2 +- src/video/windows/SDL_windowskeyboard.c | 2 +- src/video/windows/SDL_windowsmessagebox.c | 2 +- src/video/windows/SDL_windowsmessagebox.h | 2 +- src/video/windows/SDL_windowsmodes.c | 2 +- src/video/windows/SDL_windowsmouse.c | 2 +- src/video/windows/SDL_windowsopengl.c | 12 +- src/video/windows/SDL_windowsopengl.h | 6 +- src/video/windows/SDL_windowsopengles.c | 6 +- src/video/windows/SDL_windowsopengles.h | 2 +- src/video/windows/SDL_windowsshape.c | 2 +- src/video/windows/SDL_windowsvideo.c | 16 +- src/video/windows/SDL_windowsvulkan.c | 2 +- src/video/windows/SDL_windowsvulkan.h | 2 +- src/video/windows/SDL_windowswindow.c | 12 +- src/video/windows/SDL_windowswindow.h | 4 +- src/video/winrt/SDL_winrtevents.cpp | 2 +- src/video/winrt/SDL_winrtgamebar.cpp | 2 +- src/video/winrt/SDL_winrtkeyboard.cpp | 2 +- src/video/winrt/SDL_winrtmessagebox.cpp | 8 +- src/video/winrt/SDL_winrtmessagebox.h | 2 +- src/video/winrt/SDL_winrtmouse.cpp | 4 +- src/video/winrt/SDL_winrtopengles.cpp | 4 +- src/video/winrt/SDL_winrtopengles.h | 2 +- src/video/winrt/SDL_winrtpointerinput.cpp | 8 +- src/video/winrt/SDL_winrtvideo.cpp | 16 +- src/video/x11/SDL_x11clipboard.c | 2 +- src/video/x11/SDL_x11dyn.c | 2 +- src/video/x11/SDL_x11dyn.h | 16 +- src/video/x11/SDL_x11events.c | 24 +-- src/video/x11/SDL_x11framebuffer.c | 2 +- src/video/x11/SDL_x11keyboard.c | 10 +- src/video/x11/SDL_x11messagebox.c | 12 +- src/video/x11/SDL_x11messagebox.h | 2 +- src/video/x11/SDL_x11modes.c | 12 +- src/video/x11/SDL_x11modes.h | 6 +- src/video/x11/SDL_x11mouse.c | 14 +- src/video/x11/SDL_x11opengl.c | 6 +- src/video/x11/SDL_x11opengl.h | 2 +- src/video/x11/SDL_x11opengles.c | 4 +- src/video/x11/SDL_x11opengles.h | 2 +- src/video/x11/SDL_x11shape.c | 8 +- src/video/x11/SDL_x11sym.h | 18 +- src/video/x11/SDL_x11touch.c | 2 +- src/video/x11/SDL_x11video.c | 18 +- src/video/x11/SDL_x11video.h | 18 +- src/video/x11/SDL_x11vulkan.c | 2 +- src/video/x11/SDL_x11vulkan.h | 2 +- src/video/x11/SDL_x11window.c | 24 +-- src/video/x11/SDL_x11window.h | 6 +- src/video/x11/SDL_x11xfixes.c | 2 +- src/video/x11/SDL_x11xfixes.h | 2 +- src/video/x11/SDL_x11xinput2.c | 34 ++-- src/video/yuv2rgb/yuv_rgb.c | 4 +- test/checkkeys.c | 2 +- test/checkkeysthreads.c | 2 +- test/loopwavequeue.c | 4 +- test/testaudiohotplug.c | 4 +- test/testautomation_intrinsics.c | 36 ++-- test/testautomation_keyboard.c | 4 +- test/testdisplayinfo.c | 2 +- test/testevdev.c | 3 +- test/testgl.c | 4 +- test/testgles2.c | 4 +- test/testgles2_sdf.c | 4 +- test/testime.c | 2 +- test/testnative.h | 1 + 382 files changed, 1222 insertions(+), 1184 deletions(-) diff --git a/.github/workflows/psp.yml b/.github/workflows/psp.yml index 44d12366e..333bd64db 100644 --- a/.github/workflows/psp.yml +++ b/.github/workflows/psp.yml @@ -16,6 +16,10 @@ jobs: run: | apk update apk add cmake gmp mpc1 mpfr4 make pkgconf + - name: Patch the pspdev toolchain to use -isystem instead of -I + run: | + # https://github.com/pspdev/pspsdk/issues/123 + sed -E s/-I/-isystem/g -i $PSPDEV/psp/share/pspdev.cmake - name: Configure (CMake) run: | cmake -S . -B build \ diff --git a/CMakeLists.txt b/CMakeLists.txt index eb4b6e3b3..4b82a82aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -561,6 +561,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) + target_compile_options(sdl-global-options INTERFACE "-Wundef") + endif() + check_c_compiler_flag(-fno-strict-aliasing HAVE_GCC_NO_STRICT_ALIASING) if(HAVE_GCC_NO_STRICT_ALIASING) target_compile_options(sdl-global-options INTERFACE "-fno-strict-aliasing") @@ -641,13 +646,15 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC) __sync_fetch_and_add(&a, 1); __sync_bool_compare_and_swap(&a, 5, 10); __sync_bool_compare_and_swap(&x, y, z); - return 0; }" HAVE_GCC_ATOMICS) + return 0; }" COMPILER_SUPPORTS_GCC_ATOMICS) + set(HAVE_GCC_ATOMICS ${COMPILER_SUPPORTS_GCC_ATOMICS}) if(NOT HAVE_GCC_ATOMICS) check_c_source_compiles("int main(int argc, char **argv) { int a; __sync_lock_test_and_set(&a, 1); __sync_lock_release(&a); - return 0; }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET) + return 0; }" COMPILER_SUPPORTS_SYNC_LOCK_TEST_AND_SET) + set(HAVE_GCC_SYNC_LOCK_TEST_AND_SET ${COMPILER_SUPPORTS_SYNC_LOCK_TEST_AND_SET}) endif() endif() @@ -1177,7 +1184,8 @@ if(SDL_LIBC) check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION) check_symbol_exists(setjmp "setjmp.h" HAVE_SETJMP) - check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP) + check_symbol_exists(nanosleep "time.h" FOUND_NANOSLEEP) + set(HAVE_NANOSLEEP ${FOUND_NANOSLEEP}) check_symbol_exists(sysconf "unistd.h" HAVE_SYSCONF) check_symbol_exists(sysctlbyname "sys/types.h;sys/sysctl.h" HAVE_SYSCTLBYNAME) check_symbol_exists(getauxval "sys/auxv.h" HAVE_GETAUXVAL) @@ -2974,7 +2982,7 @@ if(SDL_WERROR) if(HAVE_WX) target_compile_options(sdl-global-options INTERFACE "/WX") endif() - elseif(USE_GCC OR USE_CLANG OR USE_INTELCC) + elseif(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QNX) check_c_compiler_flag(-Werror HAVE_WERROR) if(HAVE_WERROR) target_compile_options(sdl-global-options INTERFACE "-Werror") diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index b462b704f..cf048f5f5 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -879,7 +879,8 @@ macro(CheckPTHREAD) int main(int argc, char **argv) { sem_timedwait(NULL, NULL); return 0; - }" HAVE_SEM_TIMEDWAIT) + }" COMPILER_HAS_SEM_TIMEDWAIT) + set(HAVE_SEM_TIMEDWAIT ${COMPILER_HAS_SEM_TIMEDWAIT}) endif() endif() diff --git a/include/SDL3/SDL_platform_defines.h b/include/SDL3/SDL_platform_defines.h index 0122f69e4..f1bb0be7e 100644 --- a/include/SDL3/SDL_platform_defines.h +++ b/include/SDL3/SDL_platform_defines.h @@ -163,6 +163,12 @@ #define WINAPI_FAMILY_WINRT 0 #endif /* HAVE_WINAPIFAMILY_H */ +#if HAVE_WINAPIFAMILY_H && HAVE_WINAPIFAMILY_H +#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/include/build_config/SDL_build_config.h.cmake b/include/build_config/SDL_build_config.h.cmake index 3320b5cd5..55ea51de9 100644 --- a/include/build_config/SDL_build_config.h.cmake +++ b/include/build_config/SDL_build_config.h.cmake @@ -31,11 +31,6 @@ /* General platform specific identifiers */ #include -/* C language features */ -#cmakedefine const @HAVE_CONST@ -#cmakedefine inline @HAVE_INLINE@ -#cmakedefine volatile @HAVE_VOLATILE@ - /* C datatypes */ /* Define SIZEOF_VOIDP for 64/32 architectures */ #if defined(__LP64__) || defined(_LP64) || defined(_WIN64) @@ -49,7 +44,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 HAVE_ALLOCA_H 1 diff --git a/include/build_config/SDL_build_config_winrt.h b/include/build_config/SDL_build_config_winrt.h index 9fea95f62..bd628d199 100644 --- a/include/build_config/SDL_build_config_winrt.h +++ b/include/build_config/SDL_build_config_winrt.h @@ -48,7 +48,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 @@ -158,7 +158,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 @@ -205,9 +205,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/src/SDL.c b/src/SDL.c index 0fe3bbb81..70f8dd3d3 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -47,10 +47,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 @@ -171,7 +171,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Clear the error message */ SDL_ClearError(); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_Init(); #endif @@ -185,7 +185,7 @@ int SDL_InitSubSystem(Uint32 flags) flags |= SDL_INIT_EVENTS; } -#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; @@ -193,13 +193,13 @@ int SDL_InitSubSystem(Uint32 flags) } #endif -#if !SDL_TIMERS_DISABLED +#ifndef SDL_TIMERS_DISABLED SDL_InitTicks(); #endif /* Initialize the event subsystem */ if (flags & SDL_INIT_EVENTS) { -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_EVENTS)) { SDL_IncrementSubsystemRefCount(SDL_INIT_EVENTS); if (SDL_InitEvents() < 0) { @@ -218,7 +218,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_ShouldInitSubsystem(SDL_INIT_TIMER)) { SDL_IncrementSubsystemRefCount(SDL_INIT_TIMER); if (SDL_InitTimers() < 0) { @@ -237,7 +237,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_ShouldInitSubsystem(SDL_INIT_VIDEO)) { SDL_IncrementSubsystemRefCount(SDL_INIT_VIDEO); if (SDL_VideoInit(NULL) < 0) { @@ -256,7 +256,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_ShouldInitSubsystem(SDL_INIT_AUDIO)) { SDL_IncrementSubsystemRefCount(SDL_INIT_AUDIO); if (SDL_InitAudio(NULL) < 0) { @@ -275,7 +275,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_ShouldInitSubsystem(SDL_INIT_JOYSTICK)) { SDL_IncrementSubsystemRefCount(SDL_INIT_JOYSTICK); if (SDL_InitJoysticks() < 0) { @@ -293,7 +293,7 @@ int SDL_InitSubSystem(Uint32 flags) } if (flags & SDL_INIT_GAMEPAD) { -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (SDL_ShouldInitSubsystem(SDL_INIT_GAMEPAD)) { SDL_IncrementSubsystemRefCount(SDL_INIT_GAMEPAD); if (SDL_InitGamepads() < 0) { @@ -312,7 +312,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_ShouldInitSubsystem(SDL_INIT_HAPTIC)) { SDL_IncrementSubsystemRefCount(SDL_INIT_HAPTIC); if (SDL_InitHaptics() < 0) { @@ -331,7 +331,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_ShouldInitSubsystem(SDL_INIT_SENSOR)) { SDL_IncrementSubsystemRefCount(SDL_INIT_SENSOR); if (SDL_InitSensors() < 0) { @@ -365,7 +365,7 @@ int SDL_Init(Uint32 flags) void SDL_QuitSubSystem(Uint32 flags) { /* Shut down requested initialized subsystems */ -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED if (flags & SDL_INIT_SENSOR) { if (SDL_ShouldQuitSubsystem(SDL_INIT_SENSOR)) { SDL_QuitSensors(); @@ -374,7 +374,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (flags & SDL_INIT_GAMEPAD) { /* game controller implies joystick */ flags |= SDL_INIT_JOYSTICK; @@ -396,7 +396,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_HAPTIC_DISABLED +#ifndef SDL_HAPTIC_DISABLED if (flags & SDL_INIT_HAPTIC) { if (SDL_ShouldQuitSubsystem(SDL_INIT_HAPTIC)) { SDL_QuitHaptics(); @@ -405,7 +405,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_AUDIO_DISABLED +#ifndef SDL_AUDIO_DISABLED if (flags & SDL_INIT_AUDIO) { /* audio implies events */ flags |= SDL_INIT_EVENTS; @@ -417,7 +417,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_VIDEO_DISABLED +#ifndef SDL_VIDEO_DISABLED if (flags & SDL_INIT_VIDEO) { /* video implies events */ flags |= SDL_INIT_EVENTS; @@ -429,7 +429,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_ShouldQuitSubsystem(SDL_INIT_TIMER)) { SDL_QuitTimers(); @@ -438,7 +438,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (flags & SDL_INIT_EVENTS) { if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) { SDL_QuitEvents(); @@ -484,19 +484,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_QuitTicks(); #endif SDL_ClearHints(); SDL_AssertionsQuit(); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_Quit(); #endif @@ -620,10 +620,10 @@ SDL_GetPlatform(void) SDL_bool SDL_IsTablet(void) { -#if __ANDROID__ +#if defined(__ANDROID__) extern SDL_bool SDL_IsAndroidTablet(void); return SDL_IsAndroidTablet(); -#elif __IOS__ +#elif defined(__IOS__) extern SDL_bool SDL_IsIPad(void); return SDL_IsIPad(); #else diff --git a/src/SDL_log.c b/src/SDL_log.c index ff993bc3e..9988b180f 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -28,7 +28,7 @@ #include "SDL_log_c.h" -#if HAVE_STDIO_H +#ifdef HAVE_STDIO_H #include #endif @@ -484,7 +484,7 @@ 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))) (void)fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); #endif diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index 0c8d91d0f..061061661 100644 --- a/src/atomic/SDL_atomic.c +++ b/src/atomic/SDL_atomic.c @@ -104,7 +104,7 @@ extern __inline int _SDL_xadd_watcom(volatile int *a, int v); #define EMULATE_CAS 1 #endif -#if EMULATE_CAS +#ifdef EMULATE_CAS static SDL_SpinLock locks[32]; static SDL_INLINE void enterLock(void *a) @@ -136,7 +136,7 @@ SDL_AtomicCAS(SDL_AtomicInt *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_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 178302cd7..8c9b7f31d 100644 --- a/src/atomic/SDL_spinlock.c +++ b/src/atomic/SDL_spinlock.c @@ -60,7 +60,7 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v); SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock) { -#if SDL_ATOMIC_DISABLED +#if defined(SDL_ATOMIC_DISABLED) /* Terrible terrible damage */ static SDL_mutex *_spinlock_mutex; @@ -78,7 +78,7 @@ 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)) @@ -183,7 +183,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 282b1a7ae..8c5b5d4f0 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -34,70 +34,70 @@ 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_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_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_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_QNX +#ifdef SDL_AUDIO_DRIVER_QNX &QSAAUDIO_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 @@ -631,7 +631,7 @@ int SDL_ClearQueuedAudio(SDL_AudioDeviceID devid) return 0; } -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID extern void Android_JNI_AudioSetThreadPriority(int, int); #endif @@ -646,7 +646,7 @@ static int SDLCALL SDL_RunAudio(void *devicep) SDL_assert(!device->iscapture); -#if SDL_AUDIO_DRIVER_ANDROID +#if defined(SDL_AUDIO_DRIVER_ANDROID) { /* Set thread priority to THREAD_PRIORITY_AUDIO */ Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); @@ -746,7 +746,7 @@ static int SDLCALL SDL_CaptureAudio(void *devicep) SDL_assert(device->iscapture); -#if SDL_AUDIO_DRIVER_ANDROID +#if defined(SDL_AUDIO_DRIVER_ANDROID) { /* Set thread priority to THREAD_PRIORITY_AUDIO */ Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); @@ -901,7 +901,7 @@ int SDL_InitAudio(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)) { @@ -910,7 +910,7 @@ int SDL_InitAudio(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 8c683678c..b8df58ad0 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -144,7 +144,7 @@ static int SDL_ConvertAudio(SDL_AudioCVT * cvt); * 8 channels (7.1) layout: FL+FR+FC+LFE+BL+BR+SL+SR */ -#if SDL_SSE3_INTRINSICS +#if defined(SDL_SSE3_INTRINSICS) /* Convert from stereo to mono. Average left and right. */ static void SDLCALL SDL_TARGETING("sse3") SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFormat format) { @@ -181,7 +181,7 @@ static void SDLCALL SDL_TARGETING("sse3") SDL_ConvertStereoToMono_SSE3(SDL_Audio } #endif -#if SDL_SSE_INTRINSICS +#if defined(SDL_SSE_INTRINSICS) /* Convert from mono to stereo. Duplicate to stereo left and right. */ static void SDLCALL SDL_TARGETING("sse") SDL_ConvertMonoToStereo_SSE(SDL_AudioCVT *cvt, SDL_AudioFormat format) { @@ -518,10 +518,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; @@ -832,7 +834,7 @@ static 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 SDL_SSE3_INTRINSICS +#if defined(SDL_SSE3_INTRINSICS) if (!filter && SDL_HasSSE3()) { filter = SDL_ConvertStereoToMono_SSE3; } @@ -842,7 +844,7 @@ static int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, } } else if (channel_converter == SDL_ConvertMonoToStereo) { SDL_AudioFilter filter = NULL; -#if SDL_SSE_INTRINSICS +#if defined(SDL_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 4e9da0cc4..b26740dbe 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) #include #include diff --git a/src/audio/SDL_audiotypecvt.c b/src/audio/SDL_audiotypecvt.c index d7b609353..6cfe98ea5 100644 --- a/src/audio/SDL_audiotypecvt.c +++ b/src/audio/SDL_audiotypecvt.c @@ -23,21 +23,20 @@ #include "SDL_audio_c.h" #include "SDL_audiocvt_c.h" - #ifndef SDL_CPUINFO_DISABLED -#if defined(__x86_64__) && SDL_SSE2_INTRINSICS +#if defined(__x86_64__) && defined(SDL_SSE2_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */ -#elif __MACOS__ && SDL_SSE2_INTRINSICS +#elif defined(__MACOS__) && defined(SDL_SSE2_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* macOS/Intel guarantees SSE2. */ -#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && SDL_NEON_INTRINSICS +#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && defined(SDL_NEON_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */ -#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && SDL_NEON_INTRINSICS +#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(SDL_NEON_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */ #endif #endif /* !SDL_CPUINFO_DISABLED */ /* Set to zero if platform is guaranteed to use a SIMD codepath here. */ -#if !defined(NEED_SCALAR_CONVERTER_FALLBACKS) || SDL_CPUINFO_DISABLED +#if !defined(NEED_SCALAR_CONVERTER_FALLBACKS) || defined(SDL_CPUINFO_DISABLED) #define NEED_SCALAR_CONVERTER_FALLBACKS 1 #endif @@ -227,7 +226,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo } #endif -#if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) static void SDLCALL SDL_TARGETING("sse2") SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1; @@ -700,7 +699,7 @@ static void SDLCALL SDL_TARGETING("sse2") SDL_Convert_F32_to_S32_SSE2(SDL_AudioC } #endif -#if SDL_NEON_INTRINSICS +#ifdef SDL_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; @@ -1176,14 +1175,14 @@ void SDL_ChooseAudioConverters(void) SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \ converters_chosen = SDL_TRUE -#if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { SET_CONVERTER_FUNCS(SSE2); return; } #endif -#if SDL_NEON_INTRINSICS +#ifdef SDL_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 b078ffda6..9be669ab7 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_c.h" #include "../../core/android/SDL_android.h" diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index d09774e09..f95878653 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 60e5fe147..33265964f 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/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h index bce6a429d..e9565a9d2 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(__IOS__) -#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_AtomicInt device_change_flag; #else diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 936cc235d..a105efebc 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. */ @@ -46,7 +46,7 @@ } #endif -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO static const AudioObjectPropertyAddress devlist_address = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, @@ -287,7 +287,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; @@ -625,7 +625,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, @@ -679,7 +679,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); } @@ -704,7 +704,7 @@ static void COREAUDIO_CloseDevice(_THIS) open_playback_devices--; } -#if !MACOSX_COREAUDIO +#ifndef MACOSX_COREAUDIO update_audio_session(this, SDL_FALSE, SDL_TRUE); #endif @@ -733,7 +733,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; @@ -826,7 +826,7 @@ static int prepare_audioqueue(_THIS) CHECK_RESULT("AudioQueueNewOutput"); } -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if (!assign_device_to_audioqueue(this)) { return 0; } @@ -934,7 +934,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, @@ -962,7 +962,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); @@ -995,7 +995,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); @@ -1033,7 +1033,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; } @@ -1102,7 +1102,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; } @@ -1130,7 +1130,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]; @@ -1268,7 +1268,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); @@ -1283,7 +1283,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 a50074d88..b1ce62a45 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -20,14 +20,14 @@ */ #include "SDL_internal.h" -#if SDL_AUDIO_DRIVER_DSOUND +#ifdef SDL_AUDIO_DRIVER_DSOUND /* Allow access to a raw mixing buffer */ #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 */ @@ -36,7 +36,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 */ @@ -156,7 +156,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); } @@ -186,14 +186,14 @@ static BOOL CALLBACK FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVO static void DSOUND_DetectDevices(void) { -#if HAVE_MMDEVICEAPI_H +#if defined(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 +#if defined(HAVE_MMDEVICEAPI_H) } #endif /* HAVE_MMDEVICEAPI_H*/ } @@ -609,7 +609,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname) static void DSOUND_Deinitialize(void) { -#if HAVE_MMDEVICEAPI_H +#if defined(HAVE_MMDEVICEAPI_H) if (SupportsIMMDevice) { SDL_IMMDevice_Quit(); SupportsIMMDevice = SDL_FALSE; @@ -624,7 +624,7 @@ static SDL_bool DSOUND_Init(SDL_AudioDriverImpl *impl) return SDL_FALSE; } -#if HAVE_MMDEVICEAPI_H +#if defined(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 d48b3ca82..0decb30da 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 4a740e7d8..31d91b73f 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/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c index 05d17ef1f..75855a930 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_c.h" #include "SDL_emscriptenaudio.h" diff --git a/src/audio/haiku/SDL_haikuaudio.cc b/src/audio/haiku/SDL_haikuaudio.cc index 01b6d300c..ccc353aad 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 2fdec832f..19ed12822 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_audio_c.h" #include "SDL_jackaudio.h" diff --git a/src/audio/netbsd/SDL_netbsdaudio.c b/src/audio/netbsd/SDL_netbsdaudio.c index 18cf9e448..b54fac662 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 +#if defined(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 6b447081f..6966355f6 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/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c index 2387501c7..fff0a8b9a 100644 --- a/src/audio/pipewire/SDL_pipewire.c +++ b/src/audio/pipewire/SDL_pipewire.c @@ -21,7 +21,7 @@ #include "SDL_internal.h" -#if SDL_AUDIO_DRIVER_PIPEWIRE +#ifdef SDL_AUDIO_DRIVER_PIPEWIRE #include "SDL_pipewire.h" diff --git a/src/audio/psp/SDL_pspaudio.c b/src/audio/psp/SDL_pspaudio.c index 084d5c7e1..247d1fc56 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 c15256480..6c5f9a417 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/audio/pulseaudio/SDL_pulseaudio.c @@ -27,7 +27,7 @@ */ #include "SDL_internal.h" -#if SDL_AUDIO_DRIVER_PULSEAUDIO +#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO /* Allow access to a raw mixing buffer */ diff --git a/src/audio/qnx/SDL_qsa_audio.c b/src/audio/qnx/SDL_qsa_audio.c index 53b1defe1..61767e881 100644 --- a/src/audio/qnx/SDL_qsa_audio.c +++ b/src/audio/qnx/SDL_qsa_audio.c @@ -29,7 +29,7 @@ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_QNX +#ifdef SDL_AUDIO_DRIVER_QNX #include #include diff --git a/src/audio/sndio/SDL_sndioaudio.c b/src/audio/sndio/SDL_sndioaudio.c index 5afc54fee..424b5969d 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/vita/SDL_vitaaudio.c b/src/audio/vita/SDL_vitaaudio.c index 3c83d6f2b..b39f303f9 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 ac95d2295..5de499dd4 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 ba19f8d7f..df8a69d62 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 556bcd34c..879ac9232 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/core/android/SDL_android.c b/src/core/android/SDL_android.c index 8a927fc22..8da23962c 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -1050,7 +1050,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 = Android_Window->driverdata; @@ -1092,7 +1092,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/haiku/SDL_BApp.h b/src/core/haiku/SDL_BApp.h index 1dd616947..381c57fbb 100644 --- a/src/core/haiku/SDL_BApp.h +++ b/src/core/haiku/SDL_BApp.h @@ -24,7 +24,7 @@ #include #include #include -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include #endif @@ -78,7 +78,7 @@ class SDL_BApp : public BApplication public: SDL_BApp(const char *signature) : BApplication(signature) { -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _current_context = NULL; #endif } @@ -202,7 +202,7 @@ class SDL_BApp : public BApplication return _window_map[winID]; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *GetCurrentContext() { return _current_context; @@ -422,7 +422,7 @@ class SDL_BApp : public BApplication /* 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/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index 16a7c13f9..687cb8549 100644 --- a/src/core/linux/SDL_dbus.c +++ b/src/core/linux/SDL_dbus.c @@ -23,7 +23,7 @@ #include "SDL_sandbox.h" #include "../../stdlib/SDL_vacopy.h" -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* we never link directly to libdbus. */ static const char *dbus_library = "libdbus-1.so.3"; static void *dbus_handle = NULL; diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index 4f228063e..3e2cc29f5 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -124,7 +124,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 */ @@ -153,7 +153,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; @@ -216,7 +216,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 */ @@ -237,7 +237,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) { @@ -280,7 +280,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 338ba7541..46f77ea62 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 0e252d6e7..d78d7cc6c 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_ibus.c b/src/core/linux/SDL_ibus.c index 7f10a0c12..5d97c5840 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -23,6 +23,9 @@ #ifdef HAVE_IBUS_IBUS_H #include "SDL_ibus.h" #include "SDL_dbus.h" + +#ifdef SDL_USE_LIBDBUS + #include "../../video/SDL_sysvideo.h" #include "../../events/SDL_keyboard_c.h" @@ -748,4 +751,6 @@ void SDL_IBus_PumpEvents(void) } } +#endif // SDL_USE_LIBDBUS + #endif diff --git a/src/core/linux/SDL_threadprio.c b/src/core/linux/SDL_threadprio.c index 8fa687140..23b447334 100644 --- a/src/core/linux/SDL_threadprio.c +++ b/src/core/linux/SDL_threadprio.c @@ -22,7 +22,7 @@ #ifdef __LINUX__ -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED #include #include #include @@ -40,7 +40,7 @@ #include "SDL_dbus.h" -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* d-bus queries to org.freedesktop.RealtimeKit1. */ #define RTKIT_DBUS_NODE "org.freedesktop.RealtimeKit1" @@ -251,14 +251,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: @@ -283,7 +283,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; @@ -314,7 +314,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 61ba898a5..f5e831410 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/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp index 3b3231da1..d3f0689c8 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 @@ -59,7 +59,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. */ @@ -121,7 +121,7 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify int w = (int)SDL_floorf(data->coreWindow->Bounds.Width); int h = (int)SDL_floorf(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 @@ -222,7 +222,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: // @@ -268,7 +268,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 @@ -290,7 +290,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); @@ -308,7 +308,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 @@ -545,7 +545,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(0, window, 0, 0, cursorPos.X, cursorPos.Y); #endif @@ -618,7 +618,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)) { @@ -752,7 +752,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 89d3ea8a8..9af6106cc 100644 --- a/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -87,7 +87,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: @@ -142,5 +142,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 } diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 1810a3d45..bfcf0fafc 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -42,7 +42,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 @@ -106,7 +106,7 @@ #define CPU_CFG2_LSX (1 << 6) #define CPU_CFG2_LASX (1 << 7) -#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOS__ && !__OpenBSD__ && !__FreeBSD__ +#if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(__MACOS__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) /* This is the brute force way of detecting instruction sets... the idea is borrowed from the libmpeg2 library - thanks! */ @@ -335,7 +335,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) { @@ -451,9 +451,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 79e74ff35..4fd9648ab 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -408,6 +408,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) static void dynapi_warn(const char *msg) { const char *caption = "SDL Dynamic API Failure!"; + (void)caption; /* SDL_ShowSimpleMessageBox() is a too heavy for here. */ #if (defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) MessageBoxA(NULL, msg, caption, MB_OK | MB_ICONERROR); @@ -484,7 +485,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 @@ -494,7 +495,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_procs.h b/src/dynapi/SDL_dynapi_procs.h index 5e19c316a..752cc1841 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -29,7 +29,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(void,SDL_Log,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),) SDL_DYNAPI_PROC(void,SDL_LogCritical,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogDebug,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index dd6bdd815..9cab60d21 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -25,10 +25,10 @@ #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 -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED #include "../sensor/SDL_sensor_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; @@ -109,7 +109,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; @@ -551,7 +551,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) { @@ -852,14 +852,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_UpdateJoysticks(); } #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED /* Check for sensor state change */ if (SDL_update_sensors) { SDL_UpdateSensors(); @@ -893,7 +893,7 @@ static SDL_bool SDL_events_need_periodic_poll(void) { 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 @@ -976,11 +976,11 @@ static SDL_bool SDL_events_need_polling(void) { 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_JoysticksOpened(); #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED need_polling = need_polling || (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && SDL_SensorsOpened()); #endif @@ -1355,10 +1355,10 @@ int SDL_SendSystemThemeChangedEvent(void) int SDL_InitEvents(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); @@ -1379,10 +1379,10 @@ void SDL_QuitEvents(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 fbd9fc72f..80e9dec70 100644 --- a/src/events/SDL_keysym_to_scancode.c +++ b/src/events/SDL_keysym_to_scancode.c @@ -20,7 +20,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 f06ca11d2..d103c313f 100644 --- a/src/events/SDL_quit.c +++ b/src/events/SDL_quit.c @@ -82,7 +82,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); @@ -99,7 +99,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 8d28304da..78c6304c5 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_WAYLAND || SDL_VIDEO_DRIVER_X11 +#if defined(SDL_INPUT_LINUXEV) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_X11) #include "SDL_scancode_tables_c.h" diff --git a/src/events/imKStoUCS.c b/src/events/imKStoUCS.c index b6feba6d6..503abb027 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 e26c07fbb..6fd2a2cf9 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -568,14 +568,14 @@ 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 52fc9cbbb..50f4c6c12 100644 --- a/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/src/filesystem/winrt/SDL_sysfilesystem.cpp @@ -66,7 +66,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/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c index f59b541e6..5aa16cd63 100644 --- a/src/haptic/linux/SDL_syshaptic.c +++ b/src/haptic/linux/SDL_syshaptic.c @@ -38,7 +38,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 */ @@ -156,7 +156,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"); } @@ -195,7 +195,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 == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { @@ -285,7 +285,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; @@ -601,7 +601,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 948bfd73e..2acf6fd4f 100644 --- a/src/haptic/windows/SDL_dinputhaptic.c +++ b/src/haptic/windows/SDL_dinputhaptic.c @@ -22,7 +22,7 @@ #include "../SDL_syshaptic.h" -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT #include "SDL_windowshaptic_c.h" #include "SDL_dinputhaptic_c.h" diff --git a/src/haptic/windows/SDL_windowshaptic.c b/src/haptic/windows/SDL_windowshaptic.c index 787462dbb..2856d2748 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_syshaptic.h" #include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */ @@ -155,7 +155,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; @@ -178,12 +178,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 0d93479cf..45aa109c3 100644 --- a/src/haptic/windows/SDL_windowshaptic_c.h +++ b/src/haptic/windows/SDL_windowshaptic_c.h @@ -37,7 +37,7 @@ extern "C" { */ struct haptic_hwdata { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT LPDIRECTINPUTDEVICE8 device; #endif DWORD axes[3]; /* Axes to use. */ @@ -53,14 +53,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 }; @@ -73,7 +73,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 d612b6747..fce0033c9 100644 --- a/src/haptic/windows/SDL_xinputhaptic.c +++ b/src/haptic/windows/SDL_xinputhaptic.c @@ -22,7 +22,7 @@ #include "../SDL_syshaptic.h" -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT #include "SDL_windowshaptic_c.h" #include "SDL_xinputhaptic_c.h" diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c index 1a1e12c86..31b419d38 100644 --- a/src/hidapi/SDL_hidapi.c +++ b/src/hidapi/SDL_hidapi.c @@ -31,7 +31,7 @@ #include "SDL_hidapi_c.h" -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED #if defined(__WIN32__) || defined(__WINGDK__) #include "../core/windows/SDL_windows.h" @@ -557,9 +557,9 @@ 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 @@ -582,20 +582,20 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL; #define HAVE_PLATFORM_BACKEND 1 #endif /* SDL_USE_LIBUDEV */ -#elif __MACOS__ +#elif defined(__MACOS__) #include "mac/hid.c" #define HAVE_PLATFORM_BACKEND 1 #define udev_ctx 1 -#elif __WINDOWS__ || __WINGDK__ +#elif defined(__WINDOWS__) || defined(__WINGDK__) #include "windows/hid.c" #define HAVE_PLATFORM_BACKEND 1 #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 __IOS__ || __TVOS__ +#elif defined(__IOS__) || defined(__TVOS__) /* The implementation for iOS and tvOS is in a separate .m file */ #include "hidapi/hidapi.h" #define HAVE_PLATFORM_BACKEND 1 @@ -899,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, @@ -916,7 +916,7 @@ static const struct hidapi_backend PLATFORM_Backend = { }; #endif /* HAVE_PLATFORM_BACKEND */ -#if HAVE_DRIVER_BACKEND +#ifdef HAVE_DRIVER_BACKEND static const struct hidapi_backend DRIVER_Backend = { (void *)DRIVER_hid_write, (void *)DRIVER_hid_read_timeout, @@ -958,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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) static SDL_hid_device * CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend) @@ -985,8 +985,8 @@ 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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) #define COPY_IF_EXISTS(var) \ if (pSrc->var != NULL) { \ @@ -1134,9 +1134,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) { @@ -1165,15 +1165,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 */ @@ -1195,7 +1195,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; } @@ -1215,16 +1215,16 @@ 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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) #ifdef HAVE_LIBUSB struct SDL_hid_device_info *usb_devs = NULL; struct SDL_hid_device_info *usb_dev; #endif -#if HAVE_DRIVER_BACKEND +#ifdef HAVE_DRIVER_BACKEND 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 @@ -1280,7 +1280,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 @@ -1368,14 +1368,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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) void *pDevice = NULL; if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return NULL; } -#if HAVE_PLATFORM_BACKEND +#if defined(HAVE_PLATFORM_BACKEND) if (udev_ctx) { pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number); if (pDevice != NULL) { @@ -1384,7 +1384,7 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id } #endif /* HAVE_PLATFORM_BACKEND */ -#if HAVE_DRIVER_BACKEND +#ifdef HAVE_DRIVER_BACKEND pDevice = DRIVER_hid_open(vendor_id, product_id, serial_number); if (pDevice != NULL) { return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend); @@ -1407,14 +1407,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) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB) void *pDevice = NULL; if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return NULL; } -#if HAVE_PLATFORM_BACKEND +#if defined(HAVE_PLATFORM_BACKEND) if (udev_ctx) { pDevice = PLATFORM_hid_open_path(path, bExclusive); if (pDevice != NULL) { @@ -1423,7 +1423,7 @@ SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */ } #endif /* HAVE_PLATFORM_BACKEND */ -#if HAVE_DRIVER_BACKEND +#ifdef HAVE_DRIVER_BACKEND pDevice = DRIVER_hid_open_path(path, bExclusive); if (pDevice != NULL) { return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend); @@ -1585,7 +1585,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 && (__IOS__ || __TVOS__) +#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IOS__) || defined(__TVOS__)) hid_ble_scan(active); #endif } diff --git a/src/hidapi/android/hid.cpp b/src/hidapi/android/hid.cpp index 888586b52..450cab208 100644 --- a/src/hidapi/android/hid.cpp +++ b/src/hidapi/android/hid.cpp @@ -49,7 +49,7 @@ #define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function) -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED #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 f20de73f6..9fb8da461 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 __IOS__ || __TVOS__ +#if defined(__IOS__) || 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 58b071a99..2748d8cbf 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 #define hid_init PLATFORM_hid_init @@ -130,7 +130,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 ); @@ -289,7 +289,7 @@ typedef enum { static uint64_t s_unLastUpdateTick = 0; static mach_timebase_info_data_t s_timebase_info; - + if ( self.centralManager == nil ) { return 0; @@ -299,11 +299,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 ) @@ -311,7 +311,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 ) @@ -323,7 +323,7 @@ typedef enum // we already know this peripheral if ( [self.deviceMap objectForKey: peripheral] != nil ) continue; - + NSLog( @"connected peripheral: %@", peripheral ); if ( [peripheral.name isEqualToString:@"SteamController"] ) { @@ -391,7 +391,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 @@ -407,23 +407,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; @@ -448,7 +448,7 @@ typedef enum { NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey]; NSString *log = [NSString stringWithFormat:@"Found '%@'", localName]; - + if ( [localName isEqualToString:@"SteamController"] ) { NSLog( @"%@ : %@ - %@", log, peripheral, advertisementData ); @@ -551,7 +551,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], @@ -567,7 +567,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; @@ -577,18 +577,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 @@ -598,20 +598,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], @@ -656,7 +656,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; @@ -703,7 +703,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 ); @@ -788,13 +788,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 ) ); @@ -828,7 +828,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; } @@ -952,7 +952,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; } @@ -972,7 +972,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_gamepad.c b/src/joystick/SDL_gamepad.c index 5c50e38fb..26f5f6746 100644 --- a/src/joystick/SDL_gamepad.c +++ b/src/joystick/SDL_gamepad.c @@ -30,7 +30,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 @@ -814,7 +814,7 @@ static GamepadMapping_t *SDL_PrivateGetGamepadMappingForGUID(SDL_JoystickGUID gu } } -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT if (SDL_IsJoystickXInput(guid)) { /* This is an XInput device */ return s_pXInputMapping; @@ -1135,7 +1135,7 @@ static char *SDL_PrivateGetGamepadGUIDFromMappingString(const char *pMapping) SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); SDL_memcpy(&pchGUID[0], "03000000", 8); } -#elif __MACOS__ +#elif defined(__MACOS__) if (SDL_strlen(pchGUID) == 32 && SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 && SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) { @@ -3056,7 +3056,7 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep /* translate the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_AXIS_MOTION)) { SDL_Event event; event.type = SDL_EVENT_GAMEPAD_AXIS_MOTION; @@ -3076,7 +3076,7 @@ static int SDL_SendGamepadAxis(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gamep static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_GamepadButton button, Uint8 state) { int posted; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; SDL_AssertJoysticksLocked(); @@ -3118,7 +3118,7 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam /* translate the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(event.type)) { event.common.timestamp = timestamp; event.gbutton.which = gamepad->joystick->instance_id; @@ -3130,6 +3130,7 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam return posted; } +#ifndef SDL_EVENTS_DISABLED static const Uint32 SDL_gamepad_event_list[] = { SDL_EVENT_GAMEPAD_AXIS_MOTION, SDL_EVENT_GAMEPAD_BUTTON_DOWN, @@ -3142,6 +3143,7 @@ static const Uint32 SDL_gamepad_event_list[] = { SDL_EVENT_GAMEPAD_TOUCHPAD_UP, SDL_EVENT_GAMEPAD_SENSOR_UPDATE, }; +#endif void SDL_SetGamepadEventsEnabled(SDL_bool enabled) { diff --git a/src/joystick/SDL_gamepad_db.h b/src/joystick/SDL_gamepad_db.h index d88b82a2e..841256c27 100644 --- a/src/joystick/SDL_gamepad_db.h +++ b/src/joystick/SDL_gamepad_db.h @@ -29,10 +29,10 @@ Alternatively, you can use the app located in test/controllermap */ static const char *s_GamepadMappings[] = { -#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_GamepadMappings[] = { "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,", @@ -524,7 +524,7 @@ static const char *s_GamepadMappings[] = { "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000830500006020000000000000,iBuffalo USB 2-axis 8-button Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif -#if SDL_JOYSTICK_LINUX +#ifdef SDL_JOYSTICK_LINUX "xinput,*,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:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000c82d00000090000011010000,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:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000011010000,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:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -956,7 +956,7 @@ static const char *s_GamepadMappings[] = { "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,", @@ -992,19 +992,19 @@ static const char *s_GamepadMappings[] = { "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 88dca2ebf..a35bd56ad 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -27,7 +27,7 @@ #include "SDL_gamepad_c.h" #include "SDL_joystick_c.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif #include "../video/SDL_sysvideo.h" @@ -44,7 +44,7 @@ #include #endif -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL #include "./virtual/SDL_virtualjoystick_c.h" #endif @@ -301,7 +301,7 @@ int SDL_InitJoysticks(void) SDL_joystick_lock = SDL_CreateMutex(); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { return -1; } @@ -631,7 +631,7 @@ SDL_JoystickID SDL_AttachVirtualJoystick(SDL_JoystickType type, int naxes, int n SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc) { -#if SDL_JOYSTICK_VIRTUAL +#if defined(SDL_JOYSTICK_VIRTUAL) SDL_JoystickID retval; SDL_LockJoysticks(); @@ -645,7 +645,7 @@ SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc) int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id) { -#if SDL_JOYSTICK_VIRTUAL +#if defined(SDL_JOYSTICK_VIRTUAL) int retval; SDL_LockJoysticks(); @@ -659,7 +659,7 @@ int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id) SDL_bool SDL_IsJoystickVirtual(SDL_JoystickID instance_id) { -#if SDL_JOYSTICK_VIRTUAL +#if defined(SDL_JOYSTICK_VIRTUAL) SDL_JoystickDriver *driver; int device_index; SDL_bool is_virtual = SDL_FALSE; @@ -686,7 +686,7 @@ int SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value) { CHECK_JOYSTICK_MAGIC(joystick, -1); -#if SDL_JOYSTICK_VIRTUAL +#if defined(SDL_JOYSTICK_VIRTUAL) retval = SDL_SetJoystickVirtualAxisInner(joystick, axis, value); #else retval = SDL_SetError("SDL not built with virtual-joystick support"); @@ -705,7 +705,7 @@ int SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value { CHECK_JOYSTICK_MAGIC(joystick, -1); -#if SDL_JOYSTICK_VIRTUAL +#if defined(SDL_JOYSTICK_VIRTUAL) retval = SDL_SetJoystickVirtualButtonInner(joystick, button, value); #else retval = SDL_SetError("SDL not built with virtual-joystick support"); @@ -724,7 +724,7 @@ int SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value) { CHECK_JOYSTICK_MAGIC(joystick, -1); -#if SDL_JOYSTICK_VIRTUAL +#if defined(SDL_JOYSTICK_VIRTUAL) retval = SDL_SetJoystickVirtualHatInner(joystick, hat, value); #else retval = SDL_SetError("SDL not built with virtual-joystick support"); @@ -1304,7 +1304,7 @@ void SDL_QuitJoysticks(void) SDL_joystick_player_count = 0; } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif @@ -1404,7 +1404,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID instance_id) SDL_SetJoystickIDForPlayerIndex(player_index, instance_id); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED { SDL_Event event; @@ -1454,7 +1454,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id) { SDL_Joystick *joystick = NULL; int player_index; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; #endif @@ -1469,7 +1469,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID instance_id) } } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED event.type = SDL_EVENT_JOYSTICK_REMOVED; event.common.timestamp = 0; @@ -1538,7 +1538,7 @@ int SDL_SendJoystickAxis(Uint64 timestamp, SDL_Joystick *joystick, Uint8 axis, S /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_AXIS_MOTION)) { SDL_Event event; event.type = SDL_EVENT_JOYSTICK_AXIS_MOTION; @@ -1580,7 +1580,7 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_JOYSTICK_HAT_MOTION)) { SDL_Event event; event.type = SDL_EVENT_JOYSTICK_HAT_MOTION; @@ -1597,7 +1597,7 @@ int SDL_SendJoystickHat(Uint64 timestamp, SDL_Joystick *joystick, Uint8 hat, Uin int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 button, Uint8 state) { int posted; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; SDL_AssertJoysticksLocked(); @@ -1638,7 +1638,7 @@ int SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butto /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(event.type)) { event.common.timestamp = timestamp; event.jbutton.which = joystick->instance_id; @@ -1705,6 +1705,7 @@ void SDL_UpdateJoysticks(void) SDL_UnlockJoysticks(); } +#ifndef SDL_EVENTS_DISABLED static const Uint32 SDL_joystick_event_list[] = { SDL_EVENT_JOYSTICK_AXIS_MOTION, SDL_EVENT_JOYSTICK_HAT_MOTION, @@ -1714,6 +1715,7 @@ static const Uint32 SDL_joystick_event_list[] = { SDL_EVENT_JOYSTICK_REMOVED, SDL_EVENT_JOYSTICK_BATTERY_UPDATED }; +#endif void SDL_SetJoystickEventsEnabled(SDL_bool enabled) { @@ -2850,7 +2852,7 @@ void SDL_SendJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel 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_EventEnabled(SDL_EVENT_JOYSTICK_BATTERY_UPDATED)) { SDL_Event event; event.type = SDL_EVENT_JOYSTICK_BATTERY_UPDATED; @@ -2954,7 +2956,7 @@ int SDL_SendJoystickTouchpad(Uint64 timestamp, SDL_Joystick *joystick, int touch /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(event_type)) { SDL_Event event; event.type = event_type; @@ -2994,7 +2996,7 @@ int SDL_SendJoystickSensor(Uint64 timestamp, SDL_Joystick *joystick, SDL_SensorT SDL_memcpy(sensor->data, data, num_values * sizeof(*data)); /* Post the event, if desired */ -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_GAMEPAD_SENSOR_UPDATE)) { SDL_Event event; event.type = SDL_EVENT_GAMEPAD_SENSOR_UPDATE; diff --git a/src/joystick/apple/SDL_mfijoystick.m b/src/joystick/apple/SDL_mfijoystick.m index d6bcf803b..e54ed7740 100644 --- a/src/joystick/apple/SDL_mfijoystick.m +++ b/src/joystick/apple/SDL_mfijoystick.m @@ -28,7 +28,7 @@ #include "SDL_mfijoystick_c.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../../events/SDL_events_c.h" #endif @@ -55,6 +55,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 */ @@ -929,7 +941,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/darwin/SDL_iokitjoystick.c b/src/joystick/darwin/SDL_iokitjoystick.c index e40040b78..7ea57372c 100644 --- a/src/joystick/darwin/SDL_iokitjoystick.c +++ b/src/joystick/darwin/SDL_iokitjoystick.c @@ -235,7 +235,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 @@ -555,7 +555,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/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index f0146754c..897ae3f0f 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -189,7 +189,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 { @@ -237,7 +237,7 @@ static int IsJoystick(const char *path, int fd, char **name_return, SDL_Joystick return 1; } -#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 == NULL) { @@ -677,7 +677,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 @@ -730,7 +730,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, @@ -1594,7 +1594,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 aff3e0243..45ad16a6e 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 c624cad2a..8db17dcec 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.h b/src/joystick/virtual/SDL_virtualjoystick_c.h index 5a545e3f5..b672b8623 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 /** * Data for a virtual, software-only joystick. diff --git a/src/joystick/vita/SDL_sysjoystick.c b/src/joystick/vita/SDL_sysjoystick.c index 947e55fef..cf0585f61 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 1dc26b601..3e14b470d 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_windowsjoystick_c.h" #include "SDL_dinputjoystick_c.h" diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 08333c223..66472d0de 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 "../usb_ids.h" #include "../SDL_sysjoystick.h" diff --git a/src/joystick/windows/SDL_windowsjoystick.c b/src/joystick/windows/SDL_windowsjoystick.c index d6b17eaa2..77e3689bb 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) || SDL_JOYSTICK_XINPUT /* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de * A. Formiga's WINMM driver. @@ -241,7 +241,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); @@ -250,7 +250,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 @@ -307,7 +307,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; @@ -345,7 +345,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 @@ -363,7 +363,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) { @@ -547,11 +547,11 @@ static 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 } @@ -567,11 +567,11 @@ static 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 } @@ -813,7 +813,7 @@ 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 #endif diff --git a/src/joystick/windows/SDL_windowsjoystick_c.h b/src/joystick/windows/SDL_windowsjoystick_c.h index 405e4f258..9cd70108c 100644 --- a/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/src/joystick/windows/SDL_windowsjoystick_c.h @@ -71,7 +71,7 @@ struct joystick_hwdata { SDL_JoystickGUID guid; -#if SDL_JOYSTICK_DINPUT +#ifdef SDL_JOYSTICK_DINPUT LPDIRECTINPUTDEVICE8 InputDevice; DIDEVCAPS Capabilities; SDL_bool buffered; @@ -89,7 +89,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 24b47f02d..6831bd257 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_windowsjoystick_c.h" #include "SDL_xinputjoystick_c.h" diff --git a/src/loadso/dlopen/SDL_sysloadso.c b/src/loadso/dlopen/SDL_sysloadso.c index 22c7a0667..43ec162b0 100644 --- a/src/loadso/dlopen/SDL_sysloadso.c +++ b/src/loadso/dlopen/SDL_sysloadso.c @@ -28,7 +28,7 @@ #include #include -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "../../video/uikit/SDL_uikitvideo.h" #endif @@ -37,7 +37,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 efe5ac879..f1fe7d098 100644 --- a/src/locale/winrt/SDL_syslocale.c +++ b/src/locale/winrt/SDL_syslocale.c @@ -33,7 +33,7 @@ int 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/misc/unix/SDL_sysurl.c b/src/misc/unix/SDL_sysurl.c index 5fbc7cd77..34a6c8eaf 100644 --- a/src/misc/unix/SDL_sysurl.c +++ b/src/misc/unix/SDL_sysurl.c @@ -28,7 +28,7 @@ #include #include #include -#if USE_POSIX_SPAWN +#ifdef USE_POSIX_SPAWN #include extern char **environ; #endif @@ -37,7 +37,7 @@ int SDL_SYS_OpenURL(const char *url) { const pid_t pid1 = fork(); if (pid1 == 0) { /* child process */ -#if USE_POSIX_SPAWN +#if defined(USE_POSIX_SPAWN) pid_t pid2; const char *args[] = { "xdg-open", url, NULL }; /* Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam */ diff --git a/src/power/android/SDL_syspower.c b/src/power/android/SDL_syspower.c index 91915173e..83ec6c888 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_syspower.h" diff --git a/src/power/emscripten/SDL_syspower.c b/src/power/emscripten/SDL_syspower.c index ba5a61acf..d2ede9e8b 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 6229ab26e..70cb6508f 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 a50ba9a0e..397dd2d57 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 @@ -525,7 +525,7 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second } /* 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" @@ -616,7 +616,7 @@ SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *second { 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/macos/SDL_syspower.c b/src/power/macos/SDL_syspower.c index 25d037ba6..c2679a6f5 100644 --- a/src/power/macos/SDL_syspower.c +++ b/src/power/macos/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 882116d55..c63acf6d4 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 diff --git a/src/power/uikit/SDL_syspower.h b/src/power/uikit/SDL_syspower.h index 171b06043..40755ae6c 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 void SDL_UIKit_UpdateBatteryMonitoring(void); SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *state, int *seconds, int *percent); diff --git a/src/power/uikit/SDL_syspower.m b/src/power/uikit/SDL_syspower.m index 8c6139e8e..af931d5f0 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 114cb2c20..39d580a62 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 diff --git a/src/power/windows/SDL_syspower.c b/src/power/windows/SDL_syspower.c index 7b9fa17c7..afc645f2c 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 25b36976a..1d68320be 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_d3dmath.h" @@ -129,4 +129,4 @@ Float4X4 MatrixRotationZ(float r) return m; } -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) */ diff --git a/src/render/SDL_d3dmath.h b/src/render/SDL_d3dmath.h index 2db5fdb4a..6ced717b3 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 @@ -78,4 +78,4 @@ Float4X4 MatrixRotationZ(float r); } #endif -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) */ diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c index d297dad78..7db0398b5 100644 --- a/src/render/SDL_render.c +++ b/src/render/SDL_render.c @@ -87,33 +87,33 @@ 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_D3D12 +#ifdef SDL_VIDEO_RENDER_D3D12 &D3D12_RenderDriver, #endif -#if SDL_VIDEO_RENDER_D3D11 +#ifdef SDL_VIDEO_RENDER_D3D11 &D3D11_RenderDriver, #endif -#if SDL_VIDEO_RENDER_D3D +#ifdef SDL_VIDEO_RENDER_D3D &D3D_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_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 @@ -668,7 +668,7 @@ static int UpdateLogicalPresentation(SDL_Renderer *renderer); int SDL_GetNumRenderDrivers(void) { -#if !SDL_RENDER_DISABLED +#if !defined(SDL_RENDER_DISABLED) return SDL_arraysize(render_drivers); #else return 0; @@ -677,7 +677,7 @@ int SDL_GetNumRenderDrivers(void) const char *SDL_GetRenderDriver(int index) { -#if !SDL_RENDER_DISABLED +#if !defined(SDL_RENDER_DISABLED) if (index < 0 || index >= SDL_GetNumRenderDrivers()) { SDL_SetError("index must be in the range of 0 - %d", SDL_GetNumRenderDrivers() - 1); @@ -741,7 +741,7 @@ int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, SDL_ return 0; } -#if !SDL_RENDER_DISABLED +#if !defined(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 @@ -801,7 +801,7 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, const char *name, Uint32 flags) { -#if !SDL_RENDER_DISABLED +#if !defined(SDL_RENDER_DISABLED) SDL_Renderer *renderer = NULL; const int n = SDL_GetNumRenderDrivers(); SDL_bool batching = SDL_TRUE; @@ -948,7 +948,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); diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index d81a971ca..e81f7d79e 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.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" @@ -30,7 +30,7 @@ #include -#if SDL_VIDEO_RENDER_D3D +#ifdef SDL_VIDEO_RENDER_D3D #define D3D_DEBUG_INFO #include #endif @@ -1735,7 +1735,7 @@ SDL_GetRenderD3D9Device(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 f40db5a9d..c1d914f21 100644 --- a/src/render/direct3d/SDL_shaders_d3d.c +++ b/src/render/direct3d/SDL_shaders_d3d.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.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 85fc010a6..bda56f00e 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_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) #define COBJMACROS #include "../../core/windows/SDL_windows.h" @@ -755,7 +755,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 */ @@ -910,7 +910,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, @@ -937,7 +937,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 @@ -2232,7 +2232,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); @@ -2280,7 +2280,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) @@ -2341,7 +2341,7 @@ D3D11_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->info.flags = SDL_RENDERER_ACCELERATED; 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: * @@ -2407,7 +2407,7 @@ SDL_GetRenderD3D11Device(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 4d38c471c..0bf3609cf 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 "../../video/winrt/SDL_winrtvideo_cpp.h" extern "C" { @@ -85,7 +85,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; @@ -105,7 +105,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 2cbfac1b3..ce1757a9d 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) #ifdef __cplusplus extern "C" { diff --git a/src/render/direct3d11/SDL_shaders_d3d11.c b/src/render/direct3d11/SDL_shaders_d3d11.c index 14a535d86..875325b3e 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) #define COBJMACROS #include "../../core/windows/SDL_windows.h" @@ -56,7 +56,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 ad07a9d82..637774ce3 100644 --- a/src/render/direct3d12/SDL_render_d3d12.c +++ b/src/render/direct3d12/SDL_render_d3d12.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.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 @@ -3050,7 +3050,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 f90a91814..48a6df991 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 89464fe0c..36bedf52a 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 "../../core/windows/SDL_windows.h" #include diff --git a/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp b/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp index dd8d81c77..6dcb07ba5 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 c2a897146..bfcfc471a 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 95ddad76d..b4d7ad90b 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_sysrender.h" diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index c89dd0577..a9f4e84bb 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 "../../video/SDL_sysvideo.h" /* For SDL_RecreateWindow */ #include #include "../SDL_sysrender.h" @@ -1602,8 +1602,10 @@ static int GL_BindTexture(SDL_Renderer *renderer, SDL_Texture *texture, float *t static int GL_UnbindTexture(SDL_Renderer *renderer, SDL_Texture *texture) { GL_RenderData *data = (GL_RenderData *)renderer->driverdata; - GL_TextureData *texturedata = (GL_TextureData *)texture->driverdata; const GLenum textype = data->textype; +#if SDL_HAVE_YUV + GL_TextureData *texturedata = (GL_TextureData *)texture->driverdata; +#endif GL_ActivateRenderer(renderer); diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c index 5a206193a..0a308fb51 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 #include "SDL_shaders_gl.h" diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c index 4bb2c5c1d..f00f2e944 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 "../../video/SDL_sysvideo.h" /* For SDL_RecreateWindow */ #include @@ -243,9 +243,9 @@ 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__ #endif @@ -2135,7 +2135,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. @@ -2275,4 +2275,4 @@ SDL_RenderDriver GLES2_RenderDriver = { 0 } }; -#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !defined(SDL_RENDER_DISABLED) */ diff --git a/src/render/opengles2/SDL_shaders_gles2.c b/src/render/opengles2/SDL_shaders_gles2.c index 6055bf772..4acfdea34 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 #include "SDL_shaders_gles2.h" diff --git a/src/render/opengles2/SDL_shaders_gles2.h b/src/render/opengles2/SDL_shaders_gles2.h index 58f66f316..ac3364809 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 +#ifdef 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 36c2d393d..9a9708cd4 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" diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c index a8aeeaa21..f258f25a1 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_sysrender.h" diff --git a/src/render/software/SDL_blendfillrect.c b/src/render/software/SDL_blendfillrect.c index bdb2339da..02ad63ed8 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 d0e7919d1..432286283 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 7e0580a87..b9993c595 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 6630e7f8c..61c4f5aed 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 8c9fb3a73..7f3c2a80a 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 3822b0e6c..24a2b10b6 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 f0908f687..7c2e075c8 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 b147aabc2..c4530394b 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_triangle.h" diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c index 26f20c373..e035932b2 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_sysrender.h" @@ -38,7 +38,7 @@ /* #define DEBUG_RAZOR */ -#if DEBUG_RAZOR +#ifdef DEBUG_RAZOR #include #endif @@ -265,7 +265,7 @@ 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 @@ -1160,7 +1160,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 a2bec9e9a..834270fe7 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 1f46e77d1..e4c2b2d26 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_sysrender.h" diff --git a/src/sensor/SDL_sensor.c b/src/sensor/SDL_sensor.c index 68e33523d..980e6a662 100644 --- a/src/sensor/SDL_sensor.c +++ b/src/sensor/SDL_sensor.c @@ -24,7 +24,7 @@ #include "SDL_syssensor.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif @@ -71,7 +71,7 @@ int SDL_InitSensors(void) SDL_sensor_lock = SDL_CreateMutex(); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { return -1; } @@ -464,7 +464,7 @@ void SDL_QuitSensors(void) SDL_UnlockSensors(); -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif @@ -488,7 +488,7 @@ int SDL_SendSensorUpdate(Uint64 timestamp, SDL_Sensor *sensor, Uint64 sensor_tim /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_EventEnabled(SDL_EVENT_SENSOR_UPDATE)) { SDL_Event event; event.type = SDL_EVENT_SENSOR_UPDATE; diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index 8fcdb5a51..c9ffd8e77 100644 --- a/src/stdlib/SDL_malloc.c +++ b/src/stdlib/SDL_malloc.c @@ -397,9 +397,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 @@ -2255,7 +2255,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) @@ -2619,7 +2619,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 */ @@ -3575,7 +3575,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 */ @@ -3726,7 +3726,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 */ @@ -3934,7 +3934,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; @@ -4117,7 +4117,7 @@ static void** ialloc(mstate m, } } -#if DEBUG +#ifdef DEBUG if (marray != chunks) { /* final element must have exactly exhausted chunk */ if (element_size != 0) { @@ -5179,7 +5179,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 3a45e6fa6..45339dd18 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1173,7 +1173,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state) const 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 @@ -1235,7 +1235,7 @@ SDLTest_CommonInit(SDLTest_CommonState *state) } SDL_free((void *)modes); -#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(displayID); SDL_Log("D3D9 Adapter Index: %d", adapterIndex); diff --git a/src/thread/SDL_thread.c b/src/thread/SDL_thread.c index 0fa11f024..75f7f5cc6 100644 --- a/src/thread/SDL_thread.c +++ b/src/thread/SDL_thread.c @@ -120,7 +120,7 @@ SDL_Generic_GetTLSData(void) SDL_TLSEntry *entry; SDL_TLSData *storage = NULL; -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED if (SDL_generic_TLS_mutex == NULL) { static SDL_SpinLock tls_lock; SDL_AtomicLock(&tls_lock); @@ -145,7 +145,7 @@ SDL_Generic_GetTLSData(void) break; } } -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED SDL_UnlockMutex(SDL_generic_TLS_mutex); #endif @@ -203,7 +203,7 @@ static SDL_error *SDL_GetStaticErrBuf(void) 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; @@ -219,7 +219,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data) SDL_error * SDL_GetErrBuf(void) { -#if SDL_THREADS_DISABLED +#if defined(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 601e1a5b4..61df77631 100644 --- a/src/thread/SDL_thread_c.h +++ b/src/thread/SDL_thread_c.h @@ -24,23 +24,23 @@ #define SDL_thread_c_h_ /* Need the definitions of SYS_ThreadHandle */ -#if SDL_THREADS_DISABLED +#if defined(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_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 a02a78f6d..9bcb55557 100644 --- a/src/thread/generic/SDL_syscond.c +++ b/src/thread/generic/SDL_syscond.c @@ -32,7 +32,7 @@ * will be chosen at runtime), the function names need to be * suffixed */ -#if !SDL_THREAD_GENERIC_COND_SUFFIX +#if !defined(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 1d9ed0cfd..b0fc3195c 100644 --- a/src/thread/generic/SDL_syscond_c.h +++ b/src/thread/generic/SDL_syscond_c.h @@ -23,7 +23,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 dc2f64e0e..62489b0e0 100644 --- a/src/thread/generic/SDL_sysmutex.c +++ b/src/thread/generic/SDL_sysmutex.c @@ -40,7 +40,7 @@ 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 +#if defined(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 +#if defined(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 +#if defined(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 147a17e48..933183c64 100644 --- a/src/thread/generic/SDL_syssem.c +++ b/src/thread/generic/SDL_syssem.c @@ -24,7 +24,7 @@ #include "SDL_systhread_c.h" -#if SDL_THREADS_DISABLED +#if defined(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 0c4da7f57..4fc92c290 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/ps2/SDL_syssem.c b/src/thread/ps2/SDL_syssem.c index a56050d6e..2c951cf46 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 a718eccab..b40b0be0c 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 a9ef2197b..2d7ba3e1c 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 19df56d45..484651083 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 +#if defined(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 +#if defined(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 +#if defined(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 0e89de958..dbad71e96 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 b9d2f3206..9f3e1a483 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 201644572..f3c128d5c 100644 --- a/src/thread/pthread/SDL_sysmutex.c +++ b/src/thread/pthread/SDL_sysmutex.c @@ -23,15 +23,16 @@ #include #include -#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 @@ -47,9 +48,9 @@ SDL_CreateMutex(void) mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex)); if (mutex) { pthread_mutexattr_init(&attr); -#if SDL_THREAD_PTHREAD_RECURSIVE_MUTEX +#if defined(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 */ @@ -76,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 @@ -84,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; @@ -112,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 @@ -121,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; @@ -159,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 aa567d4e8..4a9a06cb8 100644 --- a/src/thread/pthread/SDL_systhread.c +++ b/src/thread/pthread/SDL_systhread.c @@ -22,7 +22,7 @@ #include -#if HAVE_PTHREAD_NP_H +#ifdef HAVE_PTHREAD_NP_H #include #endif @@ -132,7 +132,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 @@ -142,7 +142,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. */ @@ -176,7 +176,7 @@ SDL_ThreadID(void) int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) { -#if __RISCOS__ +#if defined(__RISCOS__) /* FIXME: Setting thread priority does not seem to be supported */ return 0; #else @@ -234,7 +234,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 eb63be541..182cccd4e 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 bfa930d59..6124be2b6 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_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 +#if defined(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 +#if defined(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 +#if defined(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 29f6519ca..d13e83499 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 1a1ac568d..1643506bb 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 80b00b9ff..3cdd59b30 100644 --- a/src/thread/windows/SDL_syscond_cv.c +++ b/src/thread/windows/SDL_syscond_cv.c @@ -56,7 +56,7 @@ typedef struct CONDITION_VARIABLE } CONDITION_VARIABLE, *PCONDITION_VARIABLE; #endif -#if __WINRT__ +#ifdef __WINRT__ #define pWakeConditionVariable WakeConditionVariable #define pWakeAllConditionVariable WakeAllConditionVariable #define pSleepConditionVariableSRW SleepConditionVariableSRW @@ -224,7 +224,7 @@ 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 3da1d173e..25d33a9bf 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 @@ -39,7 +39,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 @@ -153,7 +153,7 @@ static SDL_mutex *SDL_CreateMutex_cs(void) if (mutex != NULL) { /* 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); @@ -224,7 +224,7 @@ 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 9bf291c4f..034681fa9 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 @@ -60,14 +60,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 @@ -232,7 +226,7 @@ static SDL_sem *SDL_CreateSemaphore_kern(Uint32 initial_value) sem = (SDL_sem_kern *)SDL_malloc(sizeof(*sem)); if (sem != NULL) { /* 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); @@ -343,7 +337,7 @@ 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 fa8e9d121..1f19afc08 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 c1e5fa487..13279dcae 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 6b7c8d5cf..15840c389 100644 --- a/src/timer/SDL_timer.c +++ b/src/timer/SDL_timer.c @@ -25,7 +25,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/unix/SDL_systimer.c b/src/timer/unix/SDL_systimer.c index 45f049f39..8411bf824 100644 --- a/src/timer/unix/SDL_systimer.c +++ b/src/timer/unix/SDL_systimer.c @@ -44,7 +44,7 @@ Also added macOS 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__ @@ -52,7 +52,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 @@ -69,7 +69,7 @@ static SDL_bool has_monotonic_time = SDL_FALSE; static void CheckMonotonicTime(void) { -#if HAVE_CLOCK_GETTIME +#if defined(HAVE_CLOCK_GETTIME) struct timespec value; if (clock_gettime(SDL_MONOTONIC_CLOCK, &value) == 0) { has_monotonic_time = SDL_TRUE; @@ -92,7 +92,7 @@ SDL_GetPerformanceCounter(void) } if (has_monotonic_time) { -#if HAVE_CLOCK_GETTIME +#if defined(HAVE_CLOCK_GETTIME) struct timespec now; clock_gettime(SDL_MONOTONIC_CLOCK, &now); @@ -124,7 +124,7 @@ SDL_GetPerformanceFrequency(void) } if (has_monotonic_time) { -#if HAVE_CLOCK_GETTIME +#if defined(HAVE_CLOCK_GETTIME) return SDL_NS_PER_SECOND; #elif defined(__APPLE__) Uint64 freq = mach_base_info.denom; @@ -141,7 +141,7 @@ void SDL_DelayNS(Uint64 ns) { int was_error; -#if HAVE_NANOSLEEP +#if defined(HAVE_NANOSLEEP) struct timespec tv, remaining; #else struct timeval tv; @@ -157,7 +157,7 @@ void SDL_DelayNS(Uint64 ns) #endif /* Set the timeout interval */ -#if HAVE_NANOSLEEP +#if defined(HAVE_NANOSLEEP) remaining.tv_sec = (time_t)(ns / SDL_NS_PER_SECOND); remaining.tv_nsec = (long)(ns % SDL_NS_PER_SECOND); #else @@ -166,7 +166,7 @@ void SDL_DelayNS(Uint64 ns) do { errno = 0; -#if HAVE_NANOSLEEP +#if defined(HAVE_NANOSLEEP) tv.tv_sec = remaining.tv_sec; tv.tv_nsec = remaining.tv_nsec; was_error = nanosleep(&tv, &remaining); diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c index 7494438fe..5ae6c88f9 100644 --- a/src/video/SDL_blit_A.c +++ b/src/video/SDL_blit_A.c @@ -166,7 +166,7 @@ static void BlitNto1SurfaceAlphaKey(SDL_BlitInfo *info) } } -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) /* fast RGB888->(A)RGB888 blending with surface alpha=128 special case */ static void SDL_TARGETING("mmx") BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo *info) @@ -411,7 +411,7 @@ static void SDL_TARGETING("mmx") BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo *info) #endif /* SDL_MMX_INTRINSICS */ -#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) @@ -441,7 +441,7 @@ static void BlitRGBtoRGBPixelAlphaARMSIMD(SDL_BlitInfo *info) } #endif -#if SDL_ARM_NEON_BLITTERS +#if defined(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) @@ -750,7 +750,7 @@ static void Blit16to16SurfaceAlpha128(SDL_BlitInfo *info, Uint16 mask) } } -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) /* fast RGB565->RGB565 blending with surface alpha */ static void SDL_TARGETING("mmx") Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info) @@ -1335,14 +1335,14 @@ 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 +#if defined(SDL_ARM_NEON_BLITTERS) if (SDL_HasNEON()) { return BlitARGBto565PixelAlphaARMNEON; } #endif -#if SDL_ARM_SIMD_BLITTERS +#if defined(SDL_ARM_SIMD_BLITTERS) if (SDL_HasARMSIMD()) { return BlitARGBto565PixelAlphaARMSIMD; } @@ -1360,7 +1360,7 @@ SDL_CalculateBlitA(SDL_Surface *surface) case 4: if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) { -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && sf->Ashift % 8 == 0 && sf->Aloss == 0) { if (SDL_HasMMX()) { return BlitRGBtoRGBPixelAlphaMMX; @@ -1368,12 +1368,12 @@ SDL_CalculateBlitA(SDL_Surface *surface) } #endif /* SDL_MMX_INTRINSICS */ if (sf->Amask == 0xff000000) { -#if SDL_ARM_NEON_BLITTERS +#if defined(SDL_ARM_NEON_BLITTERS) if (SDL_HasNEON()) { return BlitRGBtoRGBPixelAlphaARMNEON; } #endif -#if SDL_ARM_SIMD_BLITTERS +#if defined(SDL_ARM_SIMD_BLITTERS) if (SDL_HasARMSIMD()) { return BlitRGBtoRGBPixelAlphaARMSIMD; } @@ -1408,7 +1408,7 @@ SDL_CalculateBlitA(SDL_Surface *surface) case 2: if (surface->map->identity) { if (df->Gmask == 0x7e0) { -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) if (SDL_HasMMX()) { return Blit565to565SurfaceAlphaMMX; } else @@ -1417,7 +1417,7 @@ SDL_CalculateBlitA(SDL_Surface *surface) return Blit565to565SurfaceAlpha; } } else if (df->Gmask == 0x3e0) { -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) if (SDL_HasMMX()) { return Blit555to555SurfaceAlphaMMX; } else @@ -1431,7 +1431,7 @@ SDL_CalculateBlitA(SDL_Surface *surface) case 4: if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) { -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && SDL_HasMMX()) { return BlitRGBtoRGBSurfaceAlphaMMX; } diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index 023151f7a..123282eb7 100644 --- a/src/video/SDL_blit_N.c +++ b/src/video/SDL_blit_N.c @@ -45,7 +45,7 @@ enum blit_features BLIT_FEATURE_HAS_ARM_SIMD = 8 }; -#if SDL_ALTIVEC_BLITTERS +#ifdef SDL_ALTIVEC_BLITTERS #ifdef __MACOS__ #include static size_t @@ -896,7 +896,7 @@ static enum blit_features GetBlitFeatures(void) return features; } -#if __MWERKS__ +#ifdef __MWERKS__ #pragma altivec_model off #endif #else @@ -904,7 +904,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 +#if defined(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) @@ -3214,14 +3214,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 @@ -3281,7 +3281,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 }, @@ -3292,7 +3292,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 @@ -3431,7 +3431,7 @@ 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_blit_copy.c b/src/video/SDL_blit_copy.c index 2c34a8362..30abf8e95 100644 --- a/src/video/SDL_blit_copy.c +++ b/src/video/SDL_blit_copy.c @@ -23,7 +23,7 @@ #include "SDL_blit.h" #include "SDL_blit_copy.h" -#if SDL_SSE_INTRINSICS +#if defined(SDL_SSE_INTRINSICS) /* This assumes 16-byte aligned src and dst */ static SDL_INLINE void SDL_TARGETING("sse") SDL_memcpySSE(Uint8 *dst, const Uint8 *src, int len) { @@ -50,7 +50,7 @@ static SDL_INLINE void SDL_TARGETING("sse") SDL_memcpySSE(Uint8 *dst, const Uint } #endif /* SDL_SSE_INTRINSICS */ -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) #ifdef _MSC_VER #pragma warning(disable : 4799) #endif @@ -136,7 +136,7 @@ void SDL_BlitCopy(SDL_BlitInfo *info) return; } -#if SDL_SSE_INTRINSICS +#if defined(SDL_SSE_INTRINSICS) if (SDL_HasSSE() && !((uintptr_t)src & 15) && !(srcskip & 15) && !((uintptr_t)dst & 15) && !(dstskip & 15)) { @@ -149,7 +149,7 @@ void SDL_BlitCopy(SDL_BlitInfo *info) } #endif -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) if (SDL_HasMMX() && !(srcskip & 7) && !(dstskip & 7)) { SDL_BlitCopyMMX(dst, src, dstskip, srcskip, w, h); return; diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index 857dbce17..08d391261 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -20,19 +20,19 @@ */ #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 -#if SDL_VIDEO_VITA_PVR_OGL +#ifdef SDL_VIDEO_VITA_PVR_OGL #include #endif @@ -58,7 +58,7 @@ #define EGL_PRESENT_OPAQUE_EXT 0x31DF #endif /* EGL_EXT_present_opaque */ -#if SDL_VIDEO_DRIVER_RPI +#if defined(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") @@ -67,14 +67,14 @@ #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 "opengl32.dll" @@ -82,7 +82,7 @@ #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" @@ -107,7 +107,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 #endif @@ -118,7 +118,7 @@ #define EGL_PLATFORM_DEVICE_EXT 0x0 #endif -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL typedef void (APIENTRY* PFNGLGETINTEGERVPROC) (GLenum pname, GLint * params); #endif @@ -301,14 +301,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 +#if defined(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) { @@ -425,7 +425,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 +#if defined(SDL_VIDEO_DRIVER_VITA) _this->egl_data->opengl_dll_handle = opengl_dll_handle; #endif @@ -971,7 +971,7 @@ 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 @@ -1105,7 +1105,7 @@ 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. */ PFNGLGETINTEGERVPROC glGetIntegervFunc = (PFNGLGETINTEGERVPROC)SDL_GL_GetProcAddress("glGetIntegerv"); @@ -1220,7 +1220,7 @@ int SDL_EGL_DeleteContext(_THIS, SDL_GLContext context) EGLSurface * SDL_EGL_CreateSurface(_THIS, SDL_Window *window, NativeWindowType nw) { -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID EGLint format_wanted; EGLint format_got; #endif @@ -1234,7 +1234,7 @@ SDL_EGL_CreateSurface(_THIS, SDL_Window *window, 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, @@ -1302,7 +1302,7 @@ SDL_EGL_CreateSurface(_THIS, SDL_Window *window, 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 603b21663..d2a4aa74a 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 diff --git a/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c index e39e69e60..7f9f91a7b 100644 --- a/src/video/SDL_fillrect.c +++ b/src/video/SDL_fillrect.c @@ -22,7 +22,7 @@ #include "SDL_blit.h" -#if SDL_SSE_INTRINSICS +#if defined(SDL_SSE_INTRINSICS) /* *INDENT-OFF* */ /* clang-format off */ #if defined(_MSC_VER) && !defined(__clang__) @@ -247,7 +247,7 @@ int SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color) return SDL_FillSurfaceRects(dst, rect, 1, color); } -#if SDL_ARM_NEON_BLITTERS +#if defined(SDL_ARM_NEON_BLITTERS) void FillSurfaceRect8ARMNEONAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src); void FillSurfaceRect16ARMNEONAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src); void FillSurfaceRect32ARMNEONAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src); @@ -271,7 +271,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 FillSurfaceRect8ARMSIMDAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src); void FillSurfaceRect16ARMSIMDAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src); void FillSurfaceRect32ARMSIMDAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src); @@ -339,7 +339,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, return SDL_SetError("SDL_FillSurfaceRects(): Unsupported surface format"); } -#if SDL_ARM_NEON_BLITTERS +#if defined(SDL_ARM_NEON_BLITTERS) if (SDL_HasNEON() && dst->format->BytesPerPixel != 3 && fill_function == NULL) { switch (dst->format->BytesPerPixel) { case 1: @@ -354,7 +354,7 @@ int SDL_FillSurfaceRects(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 == NULL) { switch (dst->format->BytesPerPixel) { case 1: @@ -376,7 +376,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, { color |= (color << 8); color |= (color << 16); -#if SDL_SSE_INTRINSICS +#if defined(SDL_SSE_INTRINSICS) if (SDL_HasSSE()) { fill_function = SDL_FillSurfaceRect1SSE; break; @@ -389,7 +389,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, case 2: { color |= (color << 16); -#if SDL_SSE_INTRINSICS +#if defined(SDL_SSE_INTRINSICS) if (SDL_HasSSE()) { fill_function = SDL_FillSurfaceRect2SSE; break; @@ -408,7 +408,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, case 4: { -#if SDL_SSE_INTRINSICS +#if defined(SDL_SSE_INTRINSICS) if (SDL_HasSSE()) { fill_function = SDL_FillSurfaceRect4SSE; break; diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index bfcabfdea..2d1dfdfe8 100644 --- a/src/video/SDL_stretch.c +++ b/src/video/SDL_stretch.c @@ -332,13 +332,13 @@ static int scale_mat(const Uint32 *src, int src_w, int src_h, int src_pitch, return 0; } -#if SDL_NEON_INTRINSICS +#ifdef SDL_NEON_INTRINSICS #define CAST_uint8x8_t (uint8x8_t) #define CAST_uint32x2_t (uint32x2_t) #endif #if defined(__WINRT__) || defined(_MSC_VER) -#if SDL_NEON_INTRINSICS +#ifdef SDL_NEON_INTRINSICS #undef CAST_uint8x8_t #undef CAST_uint32x2_t #define CAST_uint8x8_t diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h index 8e90d3a4f..f78465fdd 100644 --- a/src/video/SDL_sysvideo.h +++ b/src/video/SDL_sysvideo.h @@ -439,11 +439,11 @@ struct SDL_VideoDevice SDL_VideoData *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 def279a53..7e8b0601d 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -33,20 +33,20 @@ #include -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include #endif /* SDL_VIDEO_OPENGL */ -#if SDL_VIDEO_OPENGL_ES && !SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_OPENGL_ES) && !defined(SDL_VIDEO_OPENGL) #include #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 #endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */ -#if !SDL_VIDEO_OPENGL +#if !defined(SDL_VIDEO_OPENGL) #ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR #define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB #endif @@ -64,69 +64,69 @@ /* Available video drivers */ static VideoBootStrap *bootstrap[] = { -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA &COCOA_bootstrap, #endif -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND &Wayland_bootstrap, #endif -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 &X11_bootstrap, #endif -#if SDL_VIDEO_DRIVER_VIVANTE +#ifdef SDL_VIDEO_DRIVER_VIVANTE &VIVANTE_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_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_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_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN &OFFSCREEN_bootstrap, #endif -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE &NGAGE_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 @@ -192,12 +192,12 @@ typedef struct static Uint32 SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this) { -#if (SDL_VIDEO_OPENGL && __MACOS__) || (__IOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ +#if (defined(SDL_VIDEO_OPENGL) && defined(__MACOS__)) || (defined(__IOS__) && !TARGET_OS_MACCATALYST) || defined(__ANDROID__) if (_this->GL_CreateContext != NULL) { return SDL_WINDOW_OPENGL; } #endif -#if SDL_VIDEO_METAL && (TARGET_OS_MACCATALYST || __MACOS__ || __IOS__) +#if defined(SDL_VIDEO_METAL) && (TARGET_OS_MACCATALYST || defined(__MACOS__) || defined(__IOS__)) if (_this->Metal_CreateView != NULL) { return SDL_WINDOW_METAL; } @@ -443,7 +443,7 @@ int SDL_VideoInit(const char *driver_name) SDL_VideoQuit(); } -#if !SDL_TIMERS_DISABLED +#ifndef SDL_TIMERS_DISABLED SDL_InitTicks(); #endif @@ -1377,7 +1377,7 @@ static void SDL_CheckWindowDisplayChanged(SDL_Window *window) } } -#if __WINRT__ +#ifdef __WINRT__ extern Uint32 WINRT_DetectWindowFlags(SDL_Window *window); #endif @@ -1473,7 +1473,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen) goto done; } } -#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. @@ -1913,7 +1913,7 @@ SDL_Window *SDL_CreateWindowInternal(const char *title, int x, int y, int w, int } #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. @@ -3628,7 +3628,7 @@ SDL_FunctionPointer SDL_GL_GetProcAddress(const char *proc) SDL_FunctionPointer SDL_EGL_GetProcAddress(const char *proc) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL SDL_FunctionPointer func; if (!_this) { @@ -3666,11 +3666,11 @@ 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) typedef GLenum (APIENTRY* PFNGLGETERRORPROC) (void); typedef void (APIENTRY* PFNGLGETINTEGERVPROC) (GLenum pname, GLint *params); typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGPROC) (GLenum name); -#if !SDL_VIDEO_OPENGL +#if !defined(SDL_VIDEO_OPENGL) typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); #endif @@ -3682,7 +3682,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) PFNGLGETSTRINGPROC glGetStringFunc; const char *extensions; const char *start; @@ -3776,7 +3776,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. */ @@ -3837,15 +3837,15 @@ void SDL_GL_ResetAttributes(void) _this->gl_config.retained_backing = 1; _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */ -#if SDL_VIDEO_OPENGL +#if defined(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; @@ -3870,7 +3870,7 @@ void SDL_GL_ResetAttributes(void) 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 == NULL) { @@ -3988,7 +3988,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) PFNGLGETERRORPROC glGetErrorFunc; GLenum attrib = 0; GLenum error = 0; @@ -3999,7 +3999,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 PFNGLGETSTRINGPROC glGetStringFunc; PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameterivFunc; GLenum attachment = GL_BACK_LEFT; @@ -4019,31 +4019,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 @@ -4054,20 +4054,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; @@ -4100,7 +4100,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) attrib = GL_SAMPLES; break; case SDL_GL_CONTEXT_RELEASE_BEHAVIOR: -#if SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_OPENGL) attrib = GL_CONTEXT_RELEASE_BEHAVIOR; #else attrib = GL_CONTEXT_RELEASE_BEHAVIOR_KHR; @@ -4182,7 +4182,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 = (PFNGLGETSTRINGPROC)SDL_GL_GetProcAddress("glGetString"); if (glGetStringFunc == NULL) { return -1; @@ -4320,7 +4320,7 @@ SDL_GLContext SDL_GL_GetCurrentContext(void) SDL_EGLDisplay SDL_EGL_GetCurrentEGLDisplay(void) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (!_this) { SDL_UninitializedVideo(); return EGL_NO_DISPLAY; @@ -4338,7 +4338,7 @@ SDL_EGLDisplay SDL_EGL_GetCurrentEGLDisplay(void) SDL_EGLConfig SDL_EGL_GetCurrentEGLConfig(void) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (!_this) { SDL_UninitializedVideo(); return NULL; @@ -4356,7 +4356,7 @@ SDL_EGLConfig SDL_EGL_GetCurrentEGLConfig(void) SDL_EGLConfig SDL_EGL_GetWindowEGLSurface(SDL_Window *window) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (!_this) { SDL_UninitializedVideo(); return NULL; @@ -4656,38 +4656,38 @@ 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_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "wayland/SDL_waylandmessagebox.h" #endif -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "x11/SDL_x11messagebox.h" #endif -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "haiku/SDL_bmessagebox.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_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_RISCOS) static SDL_bool SDL_IsMessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; @@ -4746,69 +4746,69 @@ 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_IsMessageboxValidForDriver(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_IsMessageboxValidForDriver(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_IsMessageboxValidForDriver(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_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_UIKIT) && UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND if (retval == -1 && SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_WAYLAND) && Wayland_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 if (retval == -1 && SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) && X11_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU if (retval == -1 && SDL_IsMessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) && HAIKU_ShowMessageBox(messageboxdata, buttonid) == 0) { retval = 0; } #endif -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS if (retval == -1 && SDL_IsMessageboxValidForDriver(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 3135eab80..4345b38bc 100644 --- a/src/video/SDL_vulkan_internal.h +++ b/src/video/SDL_vulkan_internal.h @@ -23,31 +23,31 @@ #include "SDL_internal.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_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 0bf535906..d2f5599ea 100644 --- a/src/video/SDL_vulkan_utils.c +++ b/src/video/SDL_vulkan_utils.c @@ -22,7 +22,7 @@ #include "SDL_vulkan_internal.h" -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN const char *SDL_Vulkan_GetResultString(VkResult result) { diff --git a/src/video/SDL_yuv.c b/src/video/SDL_yuv.c index cd94ec7c1..e7d5ff630 100644 --- a/src/video/SDL_yuv.c +++ b/src/video/SDL_yuv.c @@ -303,7 +303,7 @@ static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, i return 0; } -#if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) static SDL_bool SDL_TARGETING("sse2") yuv_rgb_sse( Uint32 src_format, Uint32 dst_format, Uint32 width, Uint32 height, @@ -422,7 +422,7 @@ static SDL_bool yuv_rgb_sse( } #endif -#if SDL_LSX_INTRINSICS +#ifdef SDL_LSX_INTRINSICS static SDL_bool yuv_rgb_lsx( Uint32 src_format, Uint32 dst_format, Uint32 width, Uint32 height, @@ -1122,7 +1122,7 @@ static int SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src return 0; } -#if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) static int SDL_TARGETING("sse2") SDL_ConvertPixels_PackUVPlanes_to_NV_SSE2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) { int x, y; @@ -1441,31 +1441,31 @@ static int SDL_ConvertPixels_SwapNV_std(int width, int height, const void *src, static int SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) { - #if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { return SDL_ConvertPixels_PackUVPlanes_to_NV_SSE2(width, height, src, src_pitch, dst, dst_pitch, reverseUV); } - #endif +#endif return SDL_ConvertPixels_PackUVPlanes_to_NV_std(width, height, src, src_pitch, dst, dst_pitch, reverseUV); } static int SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) { - #if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { return SDL_ConvertPixels_SplitNV_to_UVPlanes_SSE2(width, height, src, src_pitch, dst, dst_pitch, reverseUV); } - #endif +#endif return SDL_ConvertPixels_SplitNV_to_UVPlanes_std(width, height, src, src_pitch, dst, dst_pitch, reverseUV); } static int SDL_ConvertPixels_SwapNV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) { - #if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { return SDL_ConvertPixels_SwapNV_SSE2(width, height, src, src_pitch, dst, dst_pitch); } - #endif +#endif return SDL_ConvertPixels_SwapNV_std(width, height, src, src_pitch, dst, dst_pitch); } @@ -1541,7 +1541,7 @@ static int SDL_ConvertPixels_Planar2x2_to_Planar2x2(int width, int height, SDL_GetPixelFormatName(dst_format)); } -#if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) #define PACKED4_TO_PACKED4_ROW_SSE2(shuffle) \ while (x >= 4) { \ __m128i yuv = _mm_loadu_si128((__m128i *)srcYUV); \ @@ -1969,61 +1969,61 @@ static int SDL_ConvertPixels_YVYU_to_UYVY_std(int width, int height, const void static int SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) { - #if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { return SDL_ConvertPixels_YUY2_to_UYVY_SSE2(width, height, src, src_pitch, dst, dst_pitch); } - #endif +#endif return SDL_ConvertPixels_YUY2_to_UYVY_std(width, height, src, src_pitch, dst, dst_pitch); } static int SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) { - #if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { return SDL_ConvertPixels_YUY2_to_YVYU_SSE2(width, height, src, src_pitch, dst, dst_pitch); } - #endif +#endif return SDL_ConvertPixels_YUY2_to_YVYU_std(width, height, src, src_pitch, dst, dst_pitch); } static int SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) { - #if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { return SDL_ConvertPixels_UYVY_to_YUY2_SSE2(width, height, src, src_pitch, dst, dst_pitch); } - #endif +#endif return SDL_ConvertPixels_UYVY_to_YUY2_std(width, height, src, src_pitch, dst, dst_pitch); } static int SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) { - #if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { return SDL_ConvertPixels_UYVY_to_YVYU_SSE2(width, height, src, src_pitch, dst, dst_pitch); } - #endif +#endif return SDL_ConvertPixels_UYVY_to_YVYU_std(width, height, src, src_pitch, dst, dst_pitch); } static int SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) { - #if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { return SDL_ConvertPixels_YVYU_to_YUY2_SSE2(width, height, src, src_pitch, dst, dst_pitch); } - #endif +#endif return SDL_ConvertPixels_YVYU_to_YUY2_std(width, height, src, src_pitch, dst, dst_pitch); } static int SDL_ConvertPixels_YVYU_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) { - #if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) if (SDL_HasSSE2()) { return SDL_ConvertPixels_YVYU_to_UYVY_SSE2(width, height, src, src_pitch, dst, dst_pitch); } - #endif +#endif return SDL_ConvertPixels_YVYU_to_UYVY_std(width, height, src, src_pitch, dst, dst_pitch); } diff --git a/src/video/android/SDL_androidclipboard.c b/src/video/android/SDL_androidclipboard.c index 3e61c872e..6b7b25b56 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 18a5b20e2..48b50fe96 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_androidkeyboard.h" @@ -31,7 +31,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 @@ -39,7 +39,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 @@ -49,7 +49,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); @@ -67,7 +67,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) { @@ -112,7 +112,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); @@ -139,7 +139,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_EVENT_QUIT)) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_restore(Android_Window); @@ -190,7 +190,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); @@ -222,7 +222,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_EVENT_QUIT)) { SDL_LockMutex(Android_ActivityMutex); diff --git a/src/video/android/SDL_androidgl.c b/src/video/android/SDL_androidgl.c index 11d63c4da..70bbcff29 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 658ca7044..fb17e1c6e 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 4d28761c1..8dc1c9e83 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_androidmessagebox.h" #include "../../core/android/SDL_android.h" diff --git a/src/video/android/SDL_androidmessagebox.h b/src/video/android/SDL_androidmessagebox.h index 9d2b83f44..c111d00da 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 d2e8f277c..ba445bf62 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 f76121df2..18d9cd026 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 a97ac6105..5de4e33fb 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 */ @@ -122,7 +122,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; @@ -134,7 +134,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 1e16ceb34..ad072eaed 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 fbf899ad5..a2aedc78b 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 6abc585a7..7fc32a001 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_sysvideo.h" #include "../../events/SDL_keyboard_c.h" @@ -77,7 +77,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, window, (NativeWindowType)data->native_window); @@ -177,7 +177,7 @@ void Android_DestroyWindow(_THIS, SDL_Window *window) if (window->driverdata) { SDL_WindowData *data = 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); } @@ -201,7 +201,7 @@ int 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 3c5260202..a06f4f3e2 100644 --- a/src/video/android/SDL_androidwindow.h +++ b/src/video/android/SDL_androidwindow.h @@ -38,7 +38,7 @@ extern SDL_Window *Android_Window; struct SDL_WindowData { -#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 c6ea040b9..2dec20d27 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 9ca124c33..d43b518c1 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_cocoavideo.h" #include "../../events/SDL_events_c.h" @@ -129,9 +129,9 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) - (id)init; - (void)localeDidChange:(NSNotification *)notification; -- (void)observeValueForKeyPath:(NSString *)keyPath - ofObject:(id)object - change:(NSDictionary *)change +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change context:(void *)context; @end @@ -277,9 +277,9 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) SDL_SendLocaleChangedEvent(); } -- (void)observeValueForKeyPath:(NSString *)keyPath - ofObject:(id)object - change:(NSDictionary *)change +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change context:(void *)context { SDL_SetSystemTheme(Cocoa_GetSystemTheme()); diff --git a/src/video/cocoa/SDL_cocoakeyboard.m b/src/video/cocoa/SDL_cocoakeyboard.m index dbe56577a..d78ed5841 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" @@ -448,7 +448,7 @@ extern CGError CGSSetGlobalHotKeyOperatingMode(CGSConnection connection, CGSGlob void Cocoa_SetWindowKeyboardGrab(_THIS, SDL_Window *window, SDL_bool grabbed) { -#if SDL_MAC_NO_SANDBOX +#if defined(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 6fa1162d0..7dbd81a53 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 e7c8a2cef..39ec8772d 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_cocoavideo.h" diff --git a/src/video/cocoa/SDL_cocoametalview.h b/src/video/cocoa/SDL_cocoametalview.h index 2712dadd6..1c930a06e 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 d2e3e2ec6..0236b5d9e 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 diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m index 0fb5f2c86..e906ed318 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 +#if defined(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 d77fefbeb..f94f382b0 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 +#if defined(SDL_VIDEO_DRIVER_COCOA) #include "SDL_cocoamouse.h" #include "SDL_cocoavideo.h" diff --git a/src/video/cocoa/SDL_cocoaopengl.h b/src/video/cocoa/SDL_cocoaopengl.h index 3aba3d584..2c366147f 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 #import #import diff --git a/src/video/cocoa/SDL_cocoaopengl.m b/src/video/cocoa/SDL_cocoaopengl.m index 175dffb16..2da540ca7 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" @@ -273,7 +273,7 @@ SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window *window) int opaque; 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 8a95639ad..3b81c07fa 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 8206fe66b..4ef42c574 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; @@ -64,7 +64,7 @@ Cocoa_GLES_CreateContext(_THIS, SDL_Window *window) SDL_GLContext context; SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)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 803bb8a29..029a2243f 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 +#if defined(SDL_VIDEO_DRIVER_COCOA) #include "SDL_cocoavideo.h" #include "SDL_cocoashape.h" diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index f0a7b5162..0f42a03ba 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 +#if defined(SDL_VIDEO_DRIVER_COCOA) #if !__has_feature(objc_arc) #error SDL must be built with Objective-C ARC (automatic reference counting) enabled @@ -123,7 +123,7 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void) device->shape_driver.CreateShaper = Cocoa_CreateShaper; device->shape_driver.SetWindowShape = Cocoa_SetWindowShape; -#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; @@ -135,8 +135,8 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void) device->GL_DeleteContext = Cocoa_GL_DeleteContext; device->GL_GetEGLSurface = NULL; #endif -#if SDL_VIDEO_OPENGL_EGL -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_CGL if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) { #endif device->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; @@ -149,19 +149,19 @@ static SDL_VideoDevice *Cocoa_CreateDevice(void) device->GL_SwapWindow = Cocoa_GLES_SwapWindow; device->GL_DeleteContext = Cocoa_GLES_DeleteContext; device->GL_GetEGLSurface = Cocoa_GLES_GetEGLSurface; -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL } #endif #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; device->Vulkan_CreateSurface = Cocoa_Vulkan_CreateSurface; #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 7aa848c66..d49de0f43 100644 --- a/src/video/cocoa/SDL_cocoavulkan.h +++ b/src/video/cocoa/SDL_cocoavulkan.h @@ -32,7 +32,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 6e4da4311..0e971211e 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 904632071..3d276a964 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 @@ -134,7 +134,7 @@ typedef enum @property(nonatomic) SDL_Window *keyboard_focus; @property(nonatomic) Cocoa_WindowListener *listener; @property(nonatomic) SDL_CocoaVideoData *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 c1d4c5946..6502708a9 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 < 1090 #error SDL for macOS must be built with a 10.9 SDK or above. @@ -287,7 +287,7 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r) static void ScheduleContextUpdates(SDL_CocoaWindowData *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 @@ -969,7 +969,7 @@ static void Cocoa_SetKeyboardFocus(SDL_Window *window) { /*printf("WINDOWDIDCHANGESCREEN\n");*/ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL if (_data && _data.nscontexts) { for (SDLOpenGLContext *context in _data.nscontexts) { @@ -1876,8 +1876,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]; @@ -1902,9 +1902,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; @@ -2436,7 +2436,7 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window *window) SDL_CocoaWindowData *data = (SDL_CocoaWindowData *)CFBridgingRelease(window->driverdata); if (data) { -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL NSArray *contexts; @@ -2453,7 +2453,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/dummy/SDL_nullevents.c b/src/video/dummy/SDL_nullevents.c index dc799a197..6abf10709 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 935e37315..ca99b53ed 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 d1643d119..3f4365e85 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 @@ -53,7 +53,7 @@ static int DUMMY_VideoInit(_THIS); static int DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode); static void DUMMY_VideoQuit(_THIS); -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV static int evdev = 0; static void DUMMY_EVDEV_Poll(_THIS); #endif @@ -67,7 +67,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; @@ -103,7 +103,7 @@ static SDL_VideoDevice *DUMMY_CreateDevice(void) device->VideoQuit = DUMMY_VideoQuit; device->SetDisplayMode = DUMMY_SetDisplayMode; device->PumpEvents = DUMMY_PumpEvents; -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV if (evdev) { device->PumpEvents = DUMMY_EVDEV_Poll; } @@ -122,7 +122,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 @@ -150,7 +150,7 @@ int DUMMY_VideoInit(_THIS) return -1; } -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV SDL_EVDEV_Init(); #endif @@ -165,7 +165,7 @@ static int DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMod 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 b913dc93d..e6c124eff 100644 --- a/src/video/emscripten/SDL_emscriptenevents.c +++ b/src/video/emscripten/SDL_emscriptenevents.c @@ -21,7 +21,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 c9c539d4f..beb8c6496 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 872c51c38..7c3be3409 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 bb4022a0a..c97dd22c3 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 +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include #include diff --git a/src/video/emscripten/SDL_emscriptenopengles.h b/src/video/emscripten/SDL_emscriptenopengles.h index cb0a2cc88..5f264b61a 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 +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include "../SDL_sysvideo.h" diff --git a/src/video/emscripten/SDL_emscriptenvideo.c b/src/video/emscripten/SDL_emscriptenvideo.c index 2a04ea524..734a26421 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_sysvideo.h" #include "../SDL_pixels_c.h" diff --git a/src/video/haiku/SDL_BApp.h b/src/video/haiku/SDL_BApp.h index 3799e8b98..2da0dd1d9 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 @@ -78,7 +78,7 @@ class SDL_BApp : public BApplication public: SDL_BApp(const char *signature) : BApplication(signature) { -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _current_context = NULL; #endif } @@ -203,7 +203,7 @@ class SDL_BApp : public BApplication return _window_map[winID]; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *GetCurrentContext() { return _current_context; @@ -423,7 +423,7 @@ class SDL_BApp : public BApplication /* 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 a3b8e0c56..d4ae188d4 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 "../../core/haiku/SDL_BApp.h" @@ -98,7 +98,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 @@ -122,7 +122,7 @@ class SDL_BWin : public BWindow _SDL_View = NULL; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL if (_SDL_GLView) { if (((SDL_BApp *)be_app)->GetCurrentContext() == _SDL_GLView) ((SDL_BApp *)be_app)->SetCurrentContext(NULL); @@ -188,7 +188,7 @@ class SDL_BWin : public BWindow } /* * * * * OpenGL functionality * * * * */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *CreateGLView(Uint32 gl_flags) { Lock(); @@ -475,7 +475,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; @@ -711,7 +711,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 ecdadf007..7aaa3ef38 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 */ @@ -52,7 +52,7 @@ int HAIKU_SetClipboardText(_THIS, const char *text) { char *HAIKU_GetClipboardText(_THIS) { BMessage *clip = NULL; - const char *text = NULL; + const char *text = NULL; ssize_t length; char *result; if (be_clipboard->Lock()) { @@ -62,8 +62,8 @@ char *HAIKU_GetClipboardText(_THIS) { &length); } be_clipboard->Unlock(); - } - + } + if (text == NULL) { result = SDL_strdup(""); } else { @@ -71,7 +71,7 @@ char *HAIKU_GetClipboardText(_THIS) { result = (char *)SDL_malloc((length + 1) * sizeof(char)); SDL_strlcpy(result, text, length + 1); } - + return result; } @@ -81,7 +81,7 @@ SDL_bool HAIKU_HasClipboardText(_THIS) { if (text) { result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE; SDL_free(text); - } + } return result; } diff --git a/src/video/haiku/SDL_bevents.cc b/src/video/haiku/SDL_bevents.cc index d6adb58ec..9c78b12d8 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 42e7573ef..eabc0c5a8 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 b2cb73083..3f521c951 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 9f36e94b5..c578f6627 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 /* For application signature. */ diff --git a/src/video/haiku/SDL_bmessagebox.h b/src/video/haiku/SDL_bmessagebox.h index 003aff843..9c705e8de 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 81fba6d32..87a5d8062 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 @@ -282,7 +282,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 07fe8f426..dcc6108ac 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 495dfdca9..585080636 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 2a44241fa..3f8306ff5 100644 --- a/src/video/haiku/SDL_bvideo.cc +++ b/src/video/haiku/SDL_bvideo.cc @@ -22,7 +22,7 @@ #include "SDL_internal.h" #include "../../core/haiku/SDL_BApp.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "SDL_BWin.h" #include @@ -96,7 +96,7 @@ static SDL_VideoDevice * HAIKU_CreateDevice(void) device->UpdateWindowFramebuffer = HAIKU_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = HAIKU_DestroyWindowFramebuffer; -#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; @@ -273,7 +273,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 82e9ca342..b41396ff1 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 d1f672db9..a5416c48b 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 4bd4131cb..49c3368ba 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 da3064cb2..1f397d928 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 1d0614c70..01cd93cfe 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_kmsdrmvideo.h" #include "SDL_kmsdrmopengles.h" diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.h b/src/video/kmsdrm/SDL_kmsdrmopengles.h index 1912454f4..fd1ce896d 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 d8ac3f583..f19786b5c 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 "../../events/SDL_events_c.h" @@ -308,7 +308,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 da524de4c..a27521fee 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 6c0f6ba28..da9c91fc5 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/ngage/SDL_ngageevents.cpp b/src/video/ngage/SDL_ngageevents.cpp index 6e06840d0..8891469ae 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 918afeeef..a4a6c0dc7 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 d92f6a60a..cf896dd0a 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 20fa4e602..00a3cb13f 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 0b2c0b47e..8a59c2385 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 aeba83e22..25a710a29 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 638ea442e..213447243 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 c52f1601d..7c6548809 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 47a32656f..2f77bea05 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 @@ -71,7 +71,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 cfdef88fe..6031b2c5e 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) SDL_WindowData *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 522cef356..c892c05b5 100644 --- a/src/video/offscreen/SDL_offscreenwindow.h +++ b/src/video/offscreen/SDL_offscreenwindow.h @@ -28,7 +28,7 @@ struct SDL_WindowData { SDL_Window *sdl_window; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif }; diff --git a/src/video/ps2/SDL_ps2video.c b/src/video/ps2/SDL_ps2video.c index db82b0601..6d828b3a4 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 fead0e017..f17b618b1 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 f5dc28552..2b2d40c20 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 82d3d387d..a59091d31 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 72a58e112..bd901d506 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 168dd0799..5b1638e95 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 40d74752a..6380d8f3f 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_rpivideo.h" #include "SDL_rpimouse.h" diff --git a/src/video/raspberry/SDL_rpiopengles.c b/src/video/raspberry/SDL_rpiopengles.c index 18446ecef..11c99e1ca 100644 --- a/src/video/raspberry/SDL_rpiopengles.c +++ b/src/video/raspberry/SDL_rpiopengles.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.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 2b74986bd..108eff593 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 e9a584799..c0a45fe05 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 @@ -331,7 +331,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 fa8cddf25..c4e4e6535 100644 --- a/src/video/raspberry/SDL_rpivideo.h +++ b/src/video/raspberry/SDL_rpivideo.h @@ -41,7 +41,7 @@ struct SDL_DisplayData 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 42e6e825e..182f447cd 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" diff --git a/src/video/riscos/SDL_riscosframebuffer.c b/src/video/riscos/SDL_riscosframebuffer.c index 69c01e799..b7b1049d2 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 b5c6a74ce..223ef8d7a 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_riscosmessagebox.h" diff --git a/src/video/riscos/SDL_riscosmessagebox.h b/src/video/riscos/SDL_riscosmessagebox.h index 22be8fd93..ef16f392a 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 c10a1868a..6b4a9d64c 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 9ce9e34b1..16324318b 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 84871e78d..7dfae8a04 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_sysvideo.h" #include "../SDL_pixels_c.h" diff --git a/src/video/riscos/SDL_riscoswindow.c b/src/video/riscos/SDL_riscoswindow.c index 4bd522c82..743f7aba5 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_sysvideo.h" #include "../../events/SDL_mouse_c.h" diff --git a/src/video/uikit/SDL_uikitappdelegate.m b/src/video/uikit/SDL_uikitappdelegate.m index 92ffd6579..716941a5b 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" @@ -405,7 +405,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 c96391f20..79c7c229c 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 020cb8235..d0fc0cd57 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" @@ -164,7 +164,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 4a989aabd..38c90b5ae 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 59d89f449..ad2a4fa24 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_uikitvideo.h" #include "SDL_uikitwindow.h" diff --git a/src/video/uikit/SDL_uikitmetalview.h b/src/video/uikit/SDL_uikitmetalview.h index 30514755d..23a477730 100644 --- a/src/video/uikit/SDL_uikitmetalview.h +++ b/src/video/uikit/SDL_uikitmetalview.h @@ -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 23f57075b..16f6a44c4 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_sysvideo.h" diff --git a/src/video/uikit/SDL_uikitmodes.m b/src/video/uikit/SDL_uikitmodes.m index 18fe89eaa..6cd2428dd 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_uikitmodes.h" diff --git a/src/video/uikit/SDL_uikitopengles.h b/src/video/uikit/SDL_uikitopengles.h index 423192f41..b2dc1d6fa 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" diff --git a/src/video/uikit/SDL_uikitopengles.m b/src/video/uikit/SDL_uikitopengles.m index 92aeded03..674bc5622 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" @@ -94,7 +94,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 b15a2f235..bad1b2eef 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 7a13ef69b..345c933c8 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 b3dde9c17..90b902a55 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 @@ -96,7 +96,7 @@ static SDL_VideoDevice *UIKit_CreateDevice(void) device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds; device->GetWindowSizeInPixels = UIKit_GetWindowSizeInPixels; -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; device->HideScreenKeyboard = UIKit_HideScreenKeyboard; @@ -109,7 +109,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_SwapWindow = UIKit_GL_SwapWindow; device->GL_CreateContext = UIKit_GL_CreateContext; @@ -119,14 +119,14 @@ 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 = UIKit_Vulkan_GetInstanceExtensions; device->Vulkan_CreateSurface = UIKit_Vulkan_CreateSurface; #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 56171d375..415c12872 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" @@ -37,7 +37,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 @@ -379,7 +379,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) { @@ -455,7 +455,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 0e33f6020..46b0193e4 100644 --- a/src/video/uikit/SDL_uikitviewcontroller.h +++ b/src/video/uikit/SDL_uikitviewcontroller.h @@ -35,7 +35,7 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender; @end -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD @interface SDL_uikitviewcontroller : SDLRootViewController #else @interface SDL_uikitviewcontroller : SDLRootViewController @@ -68,7 +68,7 @@ @property(nonatomic, assign) int homeIndicatorHidden; #endif -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD - (void)showKeyboard; - (void)hideKeyboard; - (void)initKeyboard; @@ -86,7 +86,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 758fe4332..658a6847e 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_sysvideo.h" #include "../../events/SDL_events_c.h" @@ -78,7 +78,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char void (*animationCallback)(void *); void *animationCallbackParam; -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD SDLUITextField *textField; BOOL hardwareKeyboard; BOOL showingKeyboard; @@ -95,7 +95,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char if (self = [super initWithNibName:nil bundle:nil]) { self.window = _window; -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD [self initKeyboard]; hardwareKeyboard = NO; showingKeyboard = NO; @@ -119,7 +119,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char - (void)dealloc { -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD [self deinitKeyboard]; #endif @@ -187,7 +187,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char /* 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 @@ -258,7 +258,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char /* ---- Keyboard related functionality below this line ---- */ -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD @synthesize textInputRect; @synthesize keyboardHeight; @@ -509,7 +509,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char @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 c5afafbe9..6ea06c272 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 272fef994..c1da9dc2c 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 135bd21fc..f01178b63 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_sysvideo.h" #include "../SDL_pixels_c.h" @@ -368,7 +368,7 @@ int UIKit_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info) info->subsystem = SDL_SYSWM_UIKIT; info->info.uikit.window = data.uiwindow; -#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 3833009fc..8d4e246f0 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 c58d93883..8ceefd850 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 375a670b4..d25103baa 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 fd3277540..009335f9c 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 cc1116d42..c08976d61 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 ad4317777..63bf89e38 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 a0977c41e..87c4bda96 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 f1147849d..88dd01876 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 74884adfd..bdc041a3a 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 05e647cf3..2645a6bcb 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" @@ -64,7 +64,7 @@ static SDL_VideoDevice *VITA_Create() { SDL_VideoDevice *device; SDL_VideoData *phdata; -#if SDL_VIDEO_VITA_PIB +#if defined(SDL_VIDEO_VITA_PIB) SDL_GLDriverData *gldata; #endif /* Initialize SDL_VideoDevice structure */ @@ -81,7 +81,7 @@ static SDL_VideoDevice *VITA_Create() SDL_free(device); return NULL; } -#if SDL_VIDEO_VITA_PIB +#if defined(SDL_VIDEO_VITA_PIB) gldata = (SDL_GLDriverData *)SDL_calloc(1, sizeof(SDL_GLDriverData)); if (gldata == NULL) { diff --git a/src/video/vita/SDL_vitavideo.h b/src/video/vita/SDL_vitavideo.h index 00f7dc6ba..9a2164b2c 100644 --- a/src/video/vita/SDL_vitavideo.h +++ b/src/video/vita/SDL_vitavideo.h @@ -76,7 +76,7 @@ void VITA_RestoreWindow(_THIS, SDL_Window *window); void VITA_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed); void VITA_DestroyWindow(_THIS, SDL_Window *window); -#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 190831116..519403cf0 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 3cb5004f7..8c3f470e0 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 f0480f93d..b67116766 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 f6106a92a..172169af4 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 41da76ebf..cd0d7f880 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" @@ -83,7 +83,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; @@ -95,7 +95,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; @@ -132,7 +132,7 @@ static int VIVANTE_AddVideoDisplays(_THIS) } SDL_zero(mode); -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK data->native_display = vdkGetDisplay(videodata->vdk_private); vdkGetDisplayInfo(data->native_display, &mode.pixel_w, &mode.pixel_h, &pixels, &pitch, &bpp); @@ -168,7 +168,7 @@ int VIVANTE_VideoInit(_THIS) { SDL_VideoData *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"); @@ -226,7 +226,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; @@ -256,7 +256,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); @@ -265,7 +265,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, window, data->native_window); if (data->egl_surface == EGL_NO_SURFACE) { @@ -287,14 +287,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); @@ -308,7 +308,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 @@ -326,7 +326,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 @@ -336,7 +336,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 9a34b0275..70c9f09a0 100644 --- a/src/video/vivante/SDL_vivantevideo.h +++ b/src/video/vivante/SDL_vivantevideo.h @@ -28,7 +28,7 @@ /* Set up definitions for Vivante EGL */ #include -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK #include #else #include @@ -36,7 +36,7 @@ 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 6379fc7b1..d9267ae1b 100644 --- a/src/video/vivante/SDL_vivantevulkan.c +++ b/src/video/vivante/SDL_vivantevulkan.c @@ -26,7 +26,7 @@ * the FSL demo framework. */ -#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 bc85033bf..0d73090fd 100644 --- a/src/video/vivante/SDL_vivantevulkan.h +++ b/src/video/vivante/SDL_vivantevulkan.h @@ -31,7 +31,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 9132820e2..f24290feb 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 5557048b7..d3228a975 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 @@ -54,7 +54,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 +#if defined(SDL_THREADS_DISABLED) sigprocmask(SIG_BLOCK, &sig_set, &old_sig_set); #else pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set); @@ -76,7 +76,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 +#if defined(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 f9b63c24c..572813e9e 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 b84d6bb50..770a8d47c 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 "../../core/unix/SDL_poll.h" #include "../../events/SDL_events_c.h" diff --git a/src/video/wayland/SDL_waylandmessagebox.c b/src/video/wayland/SDL_waylandmessagebox.c index 6798c4ffb..9a4d39447 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 /* fgets */ #include /* FILE, STDOUT_FILENO, fdopen, fclose */ diff --git a/src/video/wayland/SDL_waylandmessagebox.h b/src/video/wayland/SDL_waylandmessagebox.h index a1b24d946..5472c8e68 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 ac9cd257e..51ca06160 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 @@ -177,7 +177,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); } @@ -213,7 +213,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 == NULL) { /* 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 9c992e0ec..1587b0c99 100644 --- a/src/video/wayland/SDL_waylandmouse.h +++ b/src/video/wayland/SDL_waylandmouse.h @@ -22,7 +22,7 @@ #include "SDL_internal.h" #include "SDL_waylandvideo.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#if defined(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 d4b51afc2..449669070 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 "../../core/unix/SDL_poll.h" #include "../SDL_sysvideo.h" diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index bf487db5e..4646a48c5 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 "../../events/SDL_events_c.h" #include "../../core/linux/SDL_system_theme.h" @@ -213,7 +213,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; @@ -266,7 +266,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 b0310ee80..b9155347f 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 0d03e69db..146b39d3e 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 7a35fbe08..b6c321330 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_events_c.h" @@ -2026,7 +2026,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, window, (NativeWindowType)data->egl_window); @@ -2167,7 +2167,7 @@ int Wayland_SuspendScreenSaver(_THIS) { SDL_VideoData *data = _this->driverdata; -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (SDL_DBus_ScreensaverInhibit(_this->suspend_screensaver)) { return 0; } @@ -2208,7 +2208,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) SDL_WindowData *wind = window->driverdata; if (data && wind) { -#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 7d17be72a..e2b994ac9 100644 --- a/src/video/wayland/SDL_waylandwindow.h +++ b/src/video/wayland/SDL_waylandwindow.h @@ -85,7 +85,7 @@ struct SDL_WindowData 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 cb66bcac7..d0d787b52 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 484ddf674..a619810dc 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" @@ -38,7 +38,7 @@ #include /* For WM_TABLET_QUERYSYSTEMGESTURESTATUS et. al. */ -#if HAVE_TPCSHRD_H +#ifdef HAVE_TPCSHRD_H #include #endif /* HAVE_TPCSHRD_H */ @@ -1461,7 +1461,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 678353f32..fe4d36059 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 1c4678e40..d7ec9f7da 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" diff --git a/src/video/windows/SDL_windowsmessagebox.c b/src/video/windows/SDL_windowsmessagebox.c index 00a17bd73..d95a6f7a3 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 2bbf7969c..41b5cc726 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 +#ifdef 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 0da179e82..6d5ae0faa 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 484fad61c..a3fe63231 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 f5067cc32..2e48e2dd4 100644 --- a/src/video/windows/SDL_windowsopengl.c +++ b/src/video/windows/SDL_windowsopengl.c @@ -20,14 +20,14 @@ */ #include "SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "SDL_windowsvideo.h" #include "SDL_windowsopengles.h" /* WGL implementation of SDL OpenGL support */ -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL #include #define DEFAULT_OPENGL "OPENGL32.DLL" @@ -95,7 +95,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 @@ -143,7 +143,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)) @@ -160,7 +160,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 09182fabe..75dfe7da1 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 7d1819540..c4f9d921f 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" @@ -35,7 +35,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 && !SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) { -#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; @@ -66,7 +66,7 @@ WIN_GLES_CreateContext(_THIS, SDL_Window *window) SDL_GLContext context; SDL_WindowData *data = window->driverdata; -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES && !SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) { /* Switch to WGL based functions */ diff --git a/src/video/windows/SDL_windowsopengles.h b/src/video/windows/SDL_windowsopengles.h index e019e4f87..963f2a1c8 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 cec1e83a1..093d3be3f 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 71d38300f..5e33a41f8 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_sysvideo.h" #include "../SDL_pixels_c.h" @@ -208,7 +208,7 @@ static SDL_VideoDevice *WIN_CreateDevice(void) device->shape_driver.SetWindowShape = Win32_SetWindowShape; #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; @@ -220,8 +220,8 @@ static SDL_VideoDevice *WIN_CreateDevice(void) device->GL_DeleteContext = WIN_GL_DeleteContext; device->GL_GetEGLSurface = NULL; #endif -#if SDL_VIDEO_OPENGL_EGL -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_WGL if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) { #endif /* Use EGL based functions */ @@ -235,11 +235,11 @@ static SDL_VideoDevice *WIN_CreateDevice(void) device->GL_SwapWindow = WIN_GLES_SwapWindow; device->GL_DeleteContext = WIN_GLES_DeleteContext; device->GL_GetEGLSurface = WIN_GLES_GetEGLSurface; -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL } #endif #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; @@ -566,7 +566,7 @@ int SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID) } #endif /* !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ -#if HAVE_DXGI_H +#ifdef HAVE_DXGI_H #define CINTERFACE #define COBJMACROS #include @@ -603,7 +603,7 @@ static SDL_bool DXGI_LoadDLL(void **pDXGIDLL, IDXGIFactory **pDXGIFactory) SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex) { -#if !HAVE_DXGI_H +#if !defined(HAVE_DXGI_H) if (adapterIndex) { *adapterIndex = -1; } diff --git a/src/video/windows/SDL_windowsvulkan.c b/src/video/windows/SDL_windowsvulkan.c index 77015866f..0cac196e2 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 00a40672e..d786a679e 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 e6a3748df..58dbdf7e4 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 +#if defined(SDL_VIDEO_DRIVER_WINDOWS) #include "../../core/windows/SDL_windows.h" @@ -628,14 +628,14 @@ 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 || SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) && -#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; @@ -647,7 +647,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; @@ -688,7 +688,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 1af77120d..de446989d 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" @@ -67,7 +67,7 @@ struct SDL_WindowData WCHAR *ICMFileName; SDL_Window *keyboard_focus; 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 d55b667f6..20d299daf 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 a2c87bc02..09340b55c 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 a4ed885bd..2a574c321 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 6ad182136..aeedc92dc 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 "../../core/windows/SDL_windows.h" @@ -42,7 +42,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. @@ -54,7 +54,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 @@ -105,7 +105,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 d6d2c2b1b..8786eb26a 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 c42df715a..13550f948 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: @@ -214,7 +214,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 3ce746b5e..f61bf0b88 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 */ @@ -143,7 +143,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 42dac6de3..457c71810 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 c4030dde4..71bcc9e9b 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" @@ -77,7 +77,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 @@ WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint ^ pt, Uint8 * { 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 @@ WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint ^ pt, Uint8 * 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 bd26bb331..6fae7c573 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 @@ -408,7 +408,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) || (SDL_WINRT_USE_APPLICATIONVIEW && SDL_WINAPI_FAMILY_PHONE) mode.pixel_w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width); mode.pixel_h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height); mode.screen_w = (int)SDL_floorf(appView->VisibleBounds.Width); @@ -498,7 +498,7 @@ WINRT_DetectWindowFlags(SDL_Window *window) 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 @@ -508,13 +508,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 @@ -542,7 +542,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 @@ -621,7 +621,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. */ @@ -676,7 +676,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/x11/SDL_x11clipboard.c b/src/video/x11/SDL_x11clipboard.c index 3b5a2d3ae..de7b6e79f 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 73d747f98..18174d129 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 ef2a19240..2ab8b8a9e 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 fa5a34cd9..3a24b478f 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 @@ -322,7 +322,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. */ @@ -826,14 +826,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); } @@ -945,7 +945,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 = data->window->driverdata; @@ -1057,7 +1057,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); @@ -1144,7 +1144,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); @@ -1160,7 +1160,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); @@ -1729,7 +1729,7 @@ void X11_PumpEvents(_THIS) if (!data->screensaver_activity || now >= (data->screensaver_activity + 30000)) { X11_XResetScreenSaver(data->display); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_ScreensaverTickle(); #endif @@ -1769,13 +1769,13 @@ void X11_PumpEvents(_THIS) int X11_SuspendScreenSaver(_THIS) { -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER SDL_VideoData *data = _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 0; } @@ -1785,7 +1785,7 @@ int 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 fa0617556..209c666d6 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 0cd76eaa7..b1fec82a0 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_x11video.h" @@ -73,7 +73,7 @@ X11_KeyCodeToSym(_THIS, KeyCode keycode, unsigned char group) SDL_VideoData *data = _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); @@ -128,7 +128,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; @@ -320,7 +320,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); @@ -376,7 +376,7 @@ void X11_QuitKeyboard(_THIS) { SDL_VideoData *data = _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 78fad7dd0..6234e585f 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_x11video.h" #include "SDL_x11dyn.h" @@ -83,7 +83,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 @@ -371,7 +371,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); } @@ -497,7 +497,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; @@ -520,7 +520,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); @@ -575,7 +575,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 1aef3a02a..05802ed3d 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 7760c6a3b..f14222b25 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_x11video.h" #include "edid.h" @@ -143,7 +143,7 @@ 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 */ @@ -603,7 +603,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 = _this->driverdata; int xrandr_major, xrandr_minor; @@ -621,7 +621,7 @@ int X11_InitModes(_THIS) int X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display) { -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR SDL_DisplayData *data = sdl_display->driverdata; SDL_DisplayMode mode; @@ -667,7 +667,7 @@ int X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display) return 0; } -#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; @@ -690,7 +690,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 4a12a0744..160639495 100644 --- a/src/video/x11/SDL_x11modes.h +++ b/src/video/x11/SDL_x11modes.h @@ -34,14 +34,14 @@ struct SDL_DisplayData SDL_bool use_xrandr; -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR RROutput xrandr_output; #endif }; struct SDL_DisplayModeData { -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR RRMode xrandr_mode; #else int unused; /* just so struct isn't empty. */ @@ -61,7 +61,7 @@ extern Uint32 X11_GetPixelFormatFromVisualInfo(Display *display, extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *rect); extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *rect); -#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 b8ba1c255..5337adeb3 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(void) 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 X11_WarpMouseInternal(Window xwindow, float x, float y) { SDL_VideoData *videodata = SDL_GetVideoDevice()->driverdata; Display *display = videodata->display; -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 int deviceid = 0; /* It seems XIWarpPointer() doesn't work correctly on multi-head setups: * https://developer.blender.org/rB165caafb99c6846e53d11c4e966990aaffc06cea @@ -351,7 +351,7 @@ static int X11_WarpMouse(SDL_Window *window, float x, float y) { SDL_WindowData *data = 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) { X11_WarpMouseInternal(data->xwindow, x, y); @@ -370,7 +370,7 @@ static int X11_WarpMouseGlobal(float x, float y) static int X11_SetRelativeMouseMode(SDL_bool enabled) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 if (X11_Xinput2IsInitialized()) { return 0; } @@ -413,7 +413,7 @@ static Uint32 X11_GetGlobalMouseState(float *x, float *y) /* !!! FIXME: should we XSync() here first? */ -#if !SDL_VIDEO_DRIVER_X11_XINPUT2 +#if !defined(SDL_VIDEO_DRIVER_X11_XINPUT2) videodata->global_mouse_changed = SDL_TRUE; #else if (!SDL_X11_HAVE_XINPUT2) diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c index 8f35b0cab..401e0c779 100644 --- a/src/video/x11/SDL_x11opengl.c +++ b/src/video/x11/SDL_x11opengl.c @@ -21,13 +21,13 @@ */ #include "SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" /* GLX implementation of SDL OpenGL support */ -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX #include "SDL_x11opengles.h" #if defined(__IRIX__) || defined(__NetBSD__) || defined(__OpenBSD__) @@ -250,7 +250,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_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 08569739a..5c5720877 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 #include diff --git a/src/video/x11/SDL_x11opengles.c b/src/video/x11/SDL_x11opengles.c index fd5801523..4490ca51e 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_x11video.h" #include "SDL_x11opengles.h" @@ -35,7 +35,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_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 c63a083af..41e4b7aa2 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 9d5b29953..a1dc1ddc4 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" @@ -32,7 +32,7 @@ X11_CreateShaper(SDL_Window *window) { SDL_WindowShaper *result = 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. */ @@ -62,7 +62,7 @@ X11_CreateShaper(SDL_Window *window) int X11_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode) { -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE SDL_ShapeData *data = NULL; SDL_WindowData *windowdata = NULL; Pixmap shapemask; @@ -72,7 +72,7 @@ int X11_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowS 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 7111b176c..46c1e066a 100644 --- a/src/video/x11/SDL_x11sym.h +++ b/src/video/x11/SDL_x11sym.h @@ -158,7 +158,7 @@ SDL_X11_SYM(Status,XmbTextListToTextProperty,(Display* a,char** b,int c,XICCEnco SDL_X11_SYM(Region,XCreateRegion,(void),(),return) SDL_X11_SYM(void,XDestroyRegion,(Region),(a),) -#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),) @@ -166,12 +166,12 @@ SDL_X11_SYM(int, XIBarrierReleasePointer,(Display* a, int b, PointerBarrier c, SDL_X11_SYM(Status, XFixesQueryVersion,(Display* a, int* b, int* c), (a,b,c), 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) @@ -241,7 +241,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),) @@ -249,7 +249,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) @@ -263,7 +263,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),) @@ -277,7 +277,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) @@ -306,14 +306,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),) SDL_X11_SYM(void,XShapeCombineRegion,(Display *a,Window b,int c,int d,int e,Region f,int g),(a,b,c,d,e,f,g),) diff --git a/src/video/x11/SDL_x11touch.c b/src/video/x11/SDL_x11touch.c index cbd322e33..a1c96acd0 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 3d182b2ba..6b13c35a6 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() */ @@ -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 @@ -179,7 +179,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 */ @@ -255,14 +255,14 @@ 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 */ device->shape_driver.CreateShaper = X11_CreateShaper; device->shape_driver.SetWindowShape = X11_SetWindowShape; -#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; @@ -274,8 +274,8 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->GL_DeleteContext = X11_GL_DeleteContext; device->GL_GetEGLSurface = NULL; #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_FORCE_EGL, SDL_FALSE)) { #endif device->GL_LoadLibrary = X11_GLES_LoadLibrary; @@ -288,7 +288,7 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->GL_SwapWindow = X11_GLES_SwapWindow; device->GL_DeleteContext = X11_GLES_DeleteContext; device->GL_GetEGLSurface = X11_GLES_GetEGLSurface; -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX } #endif #endif @@ -309,7 +309,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 f14794c60..aca07e14b 100644 --- a/src/video/x11/SDL_x11video.h +++ b/src/video/x11/SDL_x11video.h @@ -29,22 +29,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 @@ -77,7 +77,7 @@ 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 */ @@ -136,7 +136,7 @@ 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; @@ -144,7 +144,7 @@ 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 255fd0f1e..4d14d454d 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 17fa40c7a..ad5c069a4 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 dab23d291..eb6ad1d40 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_sysvideo.h" #include "../SDL_pixels_c.h" @@ -34,7 +34,7 @@ #include "SDL_x11xinput2.h" #include "SDL_x11xfixes.h" -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "SDL_x11opengles.h" #endif @@ -450,7 +450,7 @@ int X11_CreateWindow(_THIS, SDL_Window *window) int win_x, win_y; SDL_bool undefined_position = SDL_FALSE; -#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 != NULL && forced_visual_id[0] != '\0') { @@ -471,10 +471,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_FORCE_EGL, SDL_FALSE)) -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX && (!_this->gl_data || X11_GL_UseEGL(_this)) #endif ) { @@ -482,7 +482,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, transparent); #endif } @@ -707,15 +707,15 @@ int X11_CreateWindow(_THIS, SDL_Window *window) } 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_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; } @@ -738,12 +738,14 @@ int X11_CreateWindow(_THIS, SDL_Window *window) } #endif +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE /* Tooltips do not receive input */ - if ((window->flags & SDL_WINDOW_TOOLTIP) && SDL_X11_HAVE_XSHAPE) { + if (window->flags & SDL_WINDOW_TOOLTIP) { Region region = X11_XCreateRegion(); X11_XShapeCombineRegion(display, w, ShapeInput, 0, 0, region, ShapeSet); X11_XDestroyRegion(region); } +#endif X11_Xinput2SelectTouch(_this, window); @@ -1827,7 +1829,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 cc8620aa7..04280882d 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 @@ -71,10 +71,10 @@ struct SDL_WindowData SDL_bool flashing_window; Uint64 flash_cancel_time; SDL_Window *keyboard_focus; -#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 bd4d2cdeb..bd9cc5200 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 d4e0731c0..dcf26f8e3 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 4336854e3..26912b31e 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 = _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 = _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(void) { -#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(void) int X11_Xinput2IsMultitouchSupported(void) { -#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) 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 = 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 = window->driverdata; Display *display = data->videodata->display; diff --git a/src/video/yuv2rgb/yuv_rgb.c b/src/video/yuv2rgb/yuv_rgb.c index 9455b6230..1d498563c 100644 --- a/src/video/yuv2rgb/yuv_rgb.c +++ b/src/video/yuv2rgb/yuv_rgb.c @@ -239,7 +239,7 @@ void rgb24_yuv420_std( } } -#if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) #define SSE_FUNCTION_NAME yuv420_rgb565_sse #define STD_FUNCTION_NAME yuv420_rgb565_std @@ -684,7 +684,7 @@ void SDL_TARGETING("sse2") rgb24_yuv420_sseu(uint32_t width, uint32_t height, #endif //SDL_SSE2_INTRINSICS -#if SDL_LSX_INTRINSICS +#ifdef SDL_LSX_INTRINSICS #define LSX_FUNCTION_NAME yuv420_rgb24_lsx #define STD_FUNCTION_NAME yuv420_rgb24_std diff --git a/test/checkkeys.c b/test/checkkeys.c index dccd67291..bc4d7f126 100644 --- a/test/checkkeys.c +++ b/test/checkkeys.c @@ -294,7 +294,7 @@ int main(int argc, char *argv[]) textwin = SDLTest_TextWindowCreate(0, 0, 640, 480); -#if __IOS__ +#ifdef __IOS__ /* 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 8a058a0a5..23b93ebea 100644 --- a/test/checkkeysthreads.c +++ b/test/checkkeysthreads.c @@ -277,7 +277,7 @@ int main(int argc, char *argv[]) renderer = SDL_CreateRenderer(window, NULL, 0); SDL_RenderPresent(renderer); -#if __IOS__ +#ifdef __IOS__ /* 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 d7c3f98ed..b28c6a8fc 100644 --- a/test/loopwavequeue.c +++ b/test/loopwavequeue.c @@ -22,7 +22,7 @@ #include #include -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H #include #endif @@ -128,7 +128,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 5985583f2..333823cb0 100644 --- a/test/testaudiohotplug.c +++ b/test/testaudiohotplug.c @@ -14,7 +14,7 @@ #include -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H #include #endif @@ -196,7 +196,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_intrinsics.c b/test/testautomation_intrinsics.c index 1dc127960..7371cab8f 100644 --- a/test/testautomation_intrinsics.c +++ b/test/testautomation_intrinsics.c @@ -193,7 +193,7 @@ static void kernel_doubles_add_cpu(double *dest, const double *a, const double * } } -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) SDL_TARGETING("mmx") static void kernel_ints_add_mmx(Sint32 *dest, const Sint32 *a, const Sint32 *b, size_t size) { for (; size >= 2; size -= 2, dest += 2, a += 2, b += 2) { *(__m64*)dest = _mm_add_pi32(*(__m64*)a, *(__m64*)b); @@ -205,7 +205,7 @@ SDL_TARGETING("mmx") static void kernel_ints_add_mmx(Sint32 *dest, const Sint32 } #endif -#if SDL_SSE_INTRINSICS +#if defined(SDL_SSE_INTRINSICS) SDL_TARGETING("sse") static void kernel_floats_add_sse(float *dest, const float *a, const float *b, size_t size) { for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) { _mm_storeu_ps(dest, _mm_add_ps(_mm_loadu_ps(a), _mm_loadu_ps (b))); @@ -216,7 +216,7 @@ SDL_TARGETING("sse") static void kernel_floats_add_sse(float *dest, const float } #endif -#if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) SDL_TARGETING("sse2") static void kernel_doubles_add_sse2(double *dest, const double *a, const double *b, size_t size) { for (; size >= 2; size -= 2, dest += 2, a += 2, b += 2) { _mm_storeu_pd(dest, _mm_add_pd(_mm_loadu_pd(a), _mm_loadu_pd(b))); @@ -227,7 +227,7 @@ SDL_TARGETING("sse2") static void kernel_doubles_add_sse2(double *dest, const do } #endif -#if SDL_SSE3_INTRINSICS +#if defined(SDL_SSE3_INTRINSICS) SDL_TARGETING("sse3") static void kernel_ints_add_sse3(Sint32 *dest, const Sint32 *a, const Sint32 *b, size_t size) { for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) { _mm_storeu_si128((__m128i*)dest, _mm_add_epi32(_mm_lddqu_si128((__m128i*)a), _mm_lddqu_si128((__m128i*)b))); @@ -238,7 +238,7 @@ SDL_TARGETING("sse3") static void kernel_ints_add_sse3(Sint32 *dest, const Sint3 } #endif -#if SDL_SSE4_1_INTRINSICS +#if defined(SDL_SSE4_1_INTRINSICS) SDL_TARGETING("sse4.1") static void kernel_ints_mul_sse4_1(Sint32 *dest, const Sint32 *a, const Sint32 *b, size_t size) { for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) { _mm_storeu_si128((__m128i*)dest, _mm_mullo_epi32(_mm_lddqu_si128((__m128i*)a), _mm_lddqu_si128((__m128i*)b))); @@ -249,7 +249,7 @@ SDL_TARGETING("sse4.1") static void kernel_ints_mul_sse4_1(Sint32 *dest, const S } #endif -#if SDL_SSE4_2_INTRINSICS +#if defined(SDL_SSE4_2_INTRINSICS) SDL_TARGETING("sse4.2") static Uint32 calculate_crc32c_sse4_2(const char *text) { Uint32 crc32c = ~0; size_t len = SDL_strlen(text); @@ -280,7 +280,7 @@ SDL_TARGETING("sse4.2") static Uint32 calculate_crc32c_sse4_2(const char *text) } #endif -#if SDL_AVX_INTRINSICS +#if defined(SDL_AVX_INTRINSICS) SDL_TARGETING("avx") static void kernel_floats_add_avx(float *dest, const float *a, const float *b, size_t size) { for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) { _mm256_storeu_ps(dest, _mm256_add_ps(_mm256_loadu_ps(a), _mm256_loadu_ps(b))); @@ -291,7 +291,7 @@ SDL_TARGETING("avx") static void kernel_floats_add_avx(float *dest, const float } #endif -#if SDL_AVX2_INTRINSICS +#if defined(SDL_AVX2_INTRINSICS) SDL_TARGETING("avx2") static void kernel_ints_add_avx2(Sint32 *dest, const Sint32 *a, const Sint32 *b, size_t size) { for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) { _mm256_storeu_si256((__m256i*)dest, _mm256_add_epi32(_mm256_loadu_si256((__m256i*)a), _mm256_loadu_si256((__m256i*)b))); @@ -302,7 +302,7 @@ SDL_TARGETING("avx2") static void kernel_ints_add_avx2(Sint32 *dest, const Sint3 } #endif -#if SDL_AVX512F_INTRINSICS +#if defined(SDL_AVX512F_INTRINSICS) SDL_TARGETING("avx512f") static void kernel_floats_add_avx512f(float *dest, const float *a, const float *b, size_t size) { for (; size >= 16; size -= 16, dest += 16, a += 16, b += 16) { _mm512_storeu_ps(dest, _mm512_add_ps(_mm512_loadu_ps(a), _mm512_loadu_ps(b))); @@ -364,7 +364,7 @@ static int intrinsics_testMMX(void *arg) { if (SDL_HasMMX()) { SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has MMX support."); -#if SDL_MMX_INTRINSICS +#if defined(SDL_MMX_INTRINSICS) { size_t size; Sint32 *dest, *a, *b; @@ -392,7 +392,7 @@ static int intrinsics_testSSE(void *arg) { if (SDL_HasSSE()) { SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE support."); -#if SDL_SSE_INTRINSICS +#if defined(SDL_SSE_INTRINSICS) { size_t size; float *dest, *a, *b; @@ -420,7 +420,7 @@ static int intrinsics_testSSE2(void *arg) { if (SDL_HasSSE2()) { SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE2 support."); -#if SDL_SSE2_INTRINSICS +#if defined(SDL_SSE2_INTRINSICS) { size_t size; double *dest, *a, *b; @@ -448,7 +448,7 @@ static int intrinsics_testSSE3(void *arg) { if (SDL_HasSSE3()) { SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE3 support."); -#if SDL_SSE3_INTRINSICS +#if defined(SDL_SSE3_INTRINSICS) { size_t size; Sint32 *dest, *a, *b; @@ -476,7 +476,7 @@ static int intrinsics_testSSE4_1(void *arg) { if (SDL_HasSSE41()) { SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE4.1 support."); -#if SDL_SSE4_1_INTRINSICS +#if defined(SDL_SSE4_1_INTRINSICS) { size_t size; Sint32 *dest, *a, *b; @@ -504,7 +504,7 @@ static int intrinsics_testSSE4_2(void *arg) { if (SDL_HasSSE42()) { SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE4.2 support."); -#if SDL_SSE4_2_INTRINSICS +#if defined(SDL_SSE4_2_INTRINSICS) { struct { const char *input; @@ -539,7 +539,7 @@ static int intrinsics_testAVX(void *arg) { if (SDL_HasAVX()) { SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has AVX support."); -#if SDL_AVX_INTRINSICS +#if defined(SDL_AVX_INTRINSICS) { size_t size; float *dest, *a, *b; @@ -567,7 +567,7 @@ static int intrinsics_testAVX2(void *arg) { if (SDL_HasAVX2()) { SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has AVX2 support."); -#if SDL_AVX2_INTRINSICS +#if defined(SDL_AVX2_INTRINSICS) { size_t size; Sint32 *dest, *a, *b; @@ -595,7 +595,7 @@ static int intrinsics_testAVX512F(void *arg) { if (SDL_HasAVX512F()) { SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has AVX512F support."); -#if SDL_AVX512F_INTRINSICS +#if defined(SDL_AVX512F_INTRINSICS) { size_t size; float *dest, *a, *b; diff --git a/test/testautomation_keyboard.c b/test/testautomation_keyboard.c index f6f8d6ea3..5a3d0e900 100644 --- a/test/testautomation_keyboard.c +++ b/test/testautomation_keyboard.c @@ -461,7 +461,7 @@ static int keyboard_setTextInputRect(void *arg) static 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; @@ -474,7 +474,7 @@ static 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/testdisplayinfo.c b/test/testdisplayinfo.c index 4762cd52a..aef048280 100644 --- a/test/testdisplayinfo.c +++ b/test/testdisplayinfo.c @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) (void)SDL_snprintf(prefix, sizeof(prefix), " MODE %d", m); print_mode(prefix, modes[m]); } - SDL_free(modes); + SDL_free((void*)modes); SDL_Log("\n"); } diff --git a/test/testevdev.c b/test/testevdev.c index 4fae3295c..0393b308e 100644 --- a/test/testevdev.c +++ b/test/testevdev.c @@ -20,6 +20,7 @@ #ifdef SDL_DYNAMIC_API #undef SDL_DYNAMIC_API #endif +#define SDL_DYNAMIC_API 0 #include "../src/SDL_internal.h" @@ -29,7 +30,7 @@ static int run_test(void); /* FIXME: Need CMake tests for this */ -#if (HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX)) && HAVE_LINUX_INPUT_H +#if (defined(HAVE_LIBUDEV_H) || defined(SDL_JOYSTICK_LINUX)) && defined(HAVE_LINUX_INPUT_H) #include diff --git a/test/testgl.c b/test/testgl.c index 34d9cab73..21617c1bd 100644 --- a/test/testgl.c +++ b/test/testgl.c @@ -34,9 +34,9 @@ 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__ #endif diff --git a/test/testgles2.c b/test/testgles2.c index 7764f4c95..23085b5ab 100644 --- a/test/testgles2.c +++ b/test/testgles2.c @@ -60,9 +60,9 @@ 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__ #endif diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c index e28756d7b..34432aa29 100644 --- a/test/testgles2_sdf.c +++ b/test/testgles2_sdf.c @@ -62,9 +62,9 @@ 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__ #endif diff --git a/test/testime.c b/test/testime.c index 4073c5c9b..b4f5abd78 100644 --- a/test/testime.c +++ b/test/testime.c @@ -29,7 +29,7 @@ #ifdef HAVE_SDL_TTF #ifdef __MACOS__ #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 diff --git a/test/testnative.h b/test/testnative.h index d20f21f39..41ed6ef5f 100644 --- a/test/testnative.h +++ b/test/testnative.h @@ -20,6 +20,7 @@ #ifdef SDL_DYNAMIC_API #undef SDL_DYNAMIC_API #endif +#define SDL_DYNAMIC_API 0 #include "../src/SDL_internal.h"