Browse Source

Bumped deployment requirements for Apple platforms

We require at least Xcode 12.2 and macOS SDK 11 to build. We support deploying to macOS 10.13, iOS 11.0, and tvOS 11.0.

This cleans up the code significantly
Sam Lantinga 3 months ago
parent
commit
cdde6dd7bb

+ 4 - 4
.github/workflows/create-test-plan.py

@@ -469,7 +469,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
                     job.cmake_arguments.extend([
                         "-DCMAKE_SYSTEM_NAME=iOS",
                         "-DCMAKE_OSX_ARCHITECTURES=\"arm64\"",
-                        "-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0",
+                        "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0",
                     ])
                 case SdlPlatform.Tvos:
                     if spec.xcode:
@@ -477,7 +477,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
                     job.cmake_arguments.extend([
                         "-DCMAKE_SYSTEM_NAME=tvOS",
                         "-DCMAKE_OSX_ARCHITECTURES=\"arm64\"",
-                        "-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0",
+                        "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0",
                     ])
         case SdlPlatform.MacOS:
             if spec.apple_framework:
@@ -486,7 +486,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
                 job.test_pkg_config = False
                 job.cmake_arguments.extend((
                     "'-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64'",
-                    "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11",
+                    "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13",
                     "-DSDL_FRAMEWORK=ON",
                 ))
                 job.shared_lib = SharedLibType.FRAMEWORK
@@ -494,7 +494,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
                 job.clang_tidy = True
                 job.cmake_arguments.extend((
                     "-DCMAKE_OSX_ARCHITECTURES=arm64",
-                    "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11",
+                    "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13",
                     "-DCLANG_TIDY_BINARY=$(brew --prefix llvm)/bin/clang-tidy",
                 ))
                 job.shared_lib = SharedLibType.DYLIB

+ 6 - 6
.github/workflows/release.yml

@@ -163,7 +163,7 @@ jobs:
               -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}"  \
               -DCMAKE_SYSTEM_NAME=Darwin                                    \
               -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"                      \
-              -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11                           \
+              -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13                           \
               -Werror=dev                                                   \
               -B build_darwin
           cmake --build build_darwin --config Release --verbose
@@ -175,7 +175,7 @@ jobs:
               -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/macos-arm64_x86_64"  \
               -DCMAKE_SYSTEM_NAME=Darwin                                                                        \
               -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"                                                          \
-              -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11                                                               \
+              -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13                                                               \
               -Werror=dev                                                                                       \
               -B build_darwin_2
           cmake --build build_darwin --config Release --verbose
@@ -188,7 +188,7 @@ jobs:
               -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}"  \
               -DCMAKE_SYSTEM_NAME=iOS                                       \
               -DCMAKE_OSX_ARCHITECTURES="arm64"                             \
-              -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0                             \
+              -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0                             \
               -Werror=dev                                                   \
               -B build_ios
           cmake --build build_ios --config Release --verbose
@@ -201,7 +201,7 @@ jobs:
               -DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}"  \
               -DCMAKE_SYSTEM_NAME=tvOS                                      \
               -DCMAKE_OSX_ARCHITECTURES="arm64"                             \
-              -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0                             \
+              -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0                             \
               -Werror=dev                                                   \
               -B build_tvos
           cmake --build build_tvos --config Release --verbose
@@ -217,7 +217,7 @@ jobs:
               -DCMAKE_SYSTEM_NAME=iOS                                       \
               -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"                      \
               -DCMAKE_OSX_SYSROOT="${sysroot}"                              \
-              -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0                             \
+              -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0                            \
               -Werror=dev                                                   \
               -B build_ios_simulator
           cmake --build build_ios_simulator --config Release --verbose
@@ -233,7 +233,7 @@ jobs:
               -DCMAKE_SYSTEM_NAME=tvOS                                      \
               -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"                      \
               -DCMAKE_OSX_SYSROOT="${sysroot}"                              \
-              -DCMAKE_OSX_DEPLOYMENT_TARGET=9.0                             \
+              -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0                            \
               -Werror=dev                                                   \
               -B build_tvos_simulator
           cmake --build build_tvos_simulator --config Release --verbose

+ 6 - 6
Xcode/SDL/SDL.xcodeproj/project.pbxproj

@@ -3073,7 +3073,7 @@
 					/usr/X11R6/include,
 				);
 				INFOPLIST_FILE = "Info-Framework.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/Frameworks",
@@ -3083,7 +3083,7 @@
 					"@executable_path/../Frameworks",
 					"@loader_path/Frameworks",
 				);
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.13;
 				MARKETING_VERSION = 3.1.9;
 				OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
 				PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
@@ -3091,7 +3091,7 @@
 				STRIP_STYLE = "non-global";
 				SUPPORTED_PLATFORMS = "xrsimulator xros macosx iphonesimulator iphoneos appletvsimulator appletvos";
 				SUPPORTS_MACCATALYST = YES;
-				TVOS_DEPLOYMENT_TARGET = 9.0;
+				TVOS_DEPLOYMENT_TARGET = 11.0;
 				XROS_DEPLOYMENT_TARGET = 1.0;
 			};
 			name = Release;
@@ -3134,7 +3134,7 @@
 					/usr/X11R6/include,
 				);
 				INFOPLIST_FILE = "Info-Framework.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/Frameworks",
@@ -3144,7 +3144,7 @@
 					"@executable_path/../Frameworks",
 					"@loader_path/Frameworks",
 				);
-				MACOSX_DEPLOYMENT_TARGET = 10.11;
+				MACOSX_DEPLOYMENT_TARGET = 10.13;
 				MARKETING_VERSION = 3.1.9;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
@@ -3153,7 +3153,7 @@
 				STRIP_INSTALLED_PRODUCT = NO;
 				SUPPORTED_PLATFORMS = "xrsimulator xros macosx iphonesimulator iphoneos appletvsimulator appletvos";
 				SUPPORTS_MACCATALYST = YES;
-				TVOS_DEPLOYMENT_TARGET = 9.0;
+				TVOS_DEPLOYMENT_TARGET = 11.0;
 				XROS_DEPLOYMENT_TARGET = 1.0;
 			};
 			name = Debug;

+ 3 - 6
docs/README-ios.md

@@ -1,10 +1,10 @@
 iOS
 ======
 
-Building the Simple DirectMedia Layer for iOS 9.0+
+Building the Simple DirectMedia Layer for iOS 11.0+
 ==============================================================================
 
-Requirements: macOS 10.9 or later and the iOS 9.0 or newer SDK.
+Please note that building SDL requires at least Xcode 12.2 and the iOS 14.2 SDK.
 
 Instructions:
 
@@ -185,9 +185,6 @@ Windows:
 Textures:
 	The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_XBGR8888, and SDL_PIXELFORMAT_RGB24 pixel formats.
 
-Loading Shared Objects:
-	This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_ios.h.
-
 
 Notes -- CoreBluetooth.framework
 ==============================================================================
@@ -249,7 +246,7 @@ Note that if you are using main callbacks instead of a standard C main() functio
 Deploying to older versions of iOS
 ==============================================================================
 
-SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0
+SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 11.0
 
 In order to do that you need to download an older version of Xcode:
 https://developer.apple.com/download/more/?name=Xcode

+ 3 - 6
docs/README-macos.md

@@ -13,7 +13,7 @@ To build SDL using the command line, use the CMake build script:
 ```bash
 mkdir build
 cd build
-cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11
+cmake .. -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13
 cmake --build .
 sudo cmake --install .
 ```
@@ -25,15 +25,12 @@ You can also build SDL as a Universal library (a single binary for both
 ```bash
 mkdir build
 cd build
-cmake .. "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11
+cmake .. "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13
 cmake --build .
 sudo cmake --install .
 ```
 
-Please note that building SDL requires at least Xcode 12.2 and the 11.0 SDK.
-PowerPC support for macOS has been officially dropped as of SDL 2.0.2.
-32-bit Intel and macOS 10.8 runtime support has been officially dropped as
-of SDL 2.24.0.
+Please note that building SDL requires at least Xcode 12.2 and the macOS 11.0 SDK.
 
 To use the library once it's built, you essential have two possibilities:
 use the traditional autoconf/automake/make method, or use Xcode.

+ 11 - 0
src/SDL_internal.h

@@ -78,7 +78,18 @@
 #ifndef _DARWIN_C_SOURCE
 #define _DARWIN_C_SOURCE 1 // for memset_pattern4()
 #endif
+#include <Availability.h>
+
+#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_X_VERSION_MAX_ALLOWED
+#define __MAC_OS_X_VERSION_MAX_ALLOWED 0
 #endif
+#endif // SDL_PLATFORM_APPLE
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>

+ 10 - 25
src/audio/coreaudio/SDL_coreaudio.m

@@ -467,31 +467,16 @@ static bool UpdateAudioSession(SDL_AudioDevice *device, bool open, bool allow_pl
             options |= AVAudioSessionCategoryOptionDuckOthers;
         }
 
-        if ([session respondsToSelector:@selector(setCategory:mode:options:error:)]) {
-            if (![session.category isEqualToString:category] || session.categoryOptions != options) {
-                // Stop the current session so we don't interrupt other application audio
-                PauseAudioDevices();
-                [session setActive:NO error:nil];
-                session_active = false;
-
-                if (![session setCategory:category mode:mode options:options error:&err]) {
-                    NSString *desc = err.description;
-                    SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
-                    return false;
-                }
-            }
-        } else {
-            if (![session.category isEqualToString:category]) {
-                // Stop the current session so we don't interrupt other application audio
-                PauseAudioDevices();
-                [session setActive:NO error:nil];
-                session_active = false;
-
-                if (![session setCategory:category error:&err]) {
-                    NSString *desc = err.description;
-                    SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
-                    return false;
-                }
+        if (![session.category isEqualToString:category] || session.categoryOptions != options) {
+            // Stop the current session so we don't interrupt other application audio
+            PauseAudioDevices();
+            [session setActive:NO error:nil];
+            session_active = false;
+
+            if (![session setCategory:category mode:mode options:options error:&err]) {
+                NSString *desc = err.description;
+                SDL_SetError("Could not set Audio Session category: %s", desc.UTF8String);
+                return false;
             }
         }
 

+ 2 - 4
src/dialog/cocoa/SDL_cocoadialog.m

@@ -146,8 +146,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
     if (w) {
         // [dialog beginWithCompletionHandler:^(NSInteger result) {
         [dialog beginSheetModalForWindow:w completionHandler:^(NSInteger result) {
-            // NSModalResponseOK for >= 10.13
-            if (result == NSFileHandlingPanelOKButton) {
+            if (result == NSModalResponseOK) {
                 if (dialog_as_open) {
                     NSArray* urls = [dialog_as_open URLs];
                     const char *files[[urls count] + 1];
@@ -166,8 +165,7 @@ void SDL_SYS_ShowFileDialogWithProperties(SDL_FileDialogType type, SDL_DialogFil
             }
         }];
     } else {
-        // NSModalResponseOK for >= 10.10
-        if ([dialog runModal] == NSOKButton) {
+        if ([dialog runModal] == NSModalResponseOK) {
             if (dialog_as_open) {
                 NSArray* urls = [dialog_as_open URLs];
                 const char *files[[urls count] + 1];

+ 6 - 18
src/gpu/metal/SDL_gpu_metal.m

@@ -386,11 +386,7 @@ static MTLTextureType SDLToMetal_TextureType(SDL_GPUTextureType textureType, boo
     case SDL_GPU_TEXTURETYPE_CUBE:
         return MTLTextureTypeCube;
     case SDL_GPU_TEXTURETYPE_CUBE_ARRAY:
-        if (@available(iOS 11.0, tvOS 11.0, *)) {
-            return MTLTextureTypeCubeArray;
-        } else {
-            return MTLTextureType2D; // FIXME: I guess...?
-        }
+        return MTLTextureTypeCubeArray;
     default:
         return MTLTextureType2D;
     }
@@ -1289,10 +1285,8 @@ static void METAL_InsertDebugLabel(
             [metalCommandBuffer->computeEncoder insertDebugSignpost:label];
         } else {
             // Metal doesn't have insertDebugSignpost for command buffers...
-            if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) {
-                [metalCommandBuffer->handle pushDebugGroup:label];
-                [metalCommandBuffer->handle popDebugGroup];
-            }
+            [metalCommandBuffer->handle pushDebugGroup:label];
+            [metalCommandBuffer->handle popDebugGroup];
         }
     }
 }
@@ -1312,9 +1306,7 @@ static void METAL_PushDebugGroup(
         } else if (metalCommandBuffer->computeEncoder) {
             [metalCommandBuffer->computeEncoder pushDebugGroup:label];
         } else {
-            if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) {
-                [metalCommandBuffer->handle pushDebugGroup:label];
-            }
+            [metalCommandBuffer->handle pushDebugGroup:label];
         }
     }
 }
@@ -1332,9 +1324,7 @@ static void METAL_PopDebugGroup(
         } else if (metalCommandBuffer->computeEncoder) {
             [metalCommandBuffer->computeEncoder popDebugGroup];
         } else {
-            if (@available(macOS 10.13, iOS 11.0, tvOS 11.0, *)) {
-                [metalCommandBuffer->handle popDebugGroup];
-            }
+            [metalCommandBuffer->handle popDebugGroup];
         }
     }
 }
@@ -2418,9 +2408,7 @@ static void METAL_BindGraphicsPipeline(
         [metalCommandBuffer->renderEncoder setTriangleFillMode:SDLToMetal_PolygonMode[metalGraphicsPipeline->rasterizerState.fill_mode]];
         [metalCommandBuffer->renderEncoder setCullMode:SDLToMetal_CullMode[metalGraphicsPipeline->rasterizerState.cull_mode]];
         [metalCommandBuffer->renderEncoder setFrontFacingWinding:SDLToMetal_FrontFace[metalGraphicsPipeline->rasterizerState.front_face]];
-        if (@available(iOS 11.0, tvOS 11.0, *)) {
-            [metalCommandBuffer->renderEncoder setDepthClipMode:SDLToMetal_DepthClipMode(metalGraphicsPipeline->rasterizerState.enable_depth_clip)];
-        }
+        [metalCommandBuffer->renderEncoder setDepthClipMode:SDLToMetal_DepthClipMode(metalGraphicsPipeline->rasterizerState.enable_depth_clip)];
         [metalCommandBuffer->renderEncoder
             setDepthBias:((rast->enable_depth_bias) ? rast->depth_bias_constant_factor : 0)
               slopeScale:((rast->enable_depth_bias) ? rast->depth_bias_slope_factor : 0)

+ 6 - 6
src/hidapi/ios/hid.m

@@ -398,7 +398,7 @@ typedef enum
 {
 	switch ( central.state )
 	{
-		case CBCentralManagerStatePoweredOn:
+		case CBManagerStatePoweredOn:
 		{
 			NSLog( @"CoreBluetooth BLE hardware is powered on and ready" );
 
@@ -418,23 +418,23 @@ typedef enum
 			break;
 		}
 
-		case CBCentralManagerStatePoweredOff:
+		case CBManagerStatePoweredOff:
 			NSLog( @"CoreBluetooth BLE hardware is powered off" );
 			break;
 
-		case CBCentralManagerStateUnauthorized:
+		case CBManagerStateUnauthorized:
 			NSLog( @"CoreBluetooth BLE state is unauthorized" );
 			break;
 
-		case CBCentralManagerStateUnknown:
+		case CBManagerStateUnknown:
 			NSLog( @"CoreBluetooth BLE state is unknown" );
 			break;
 
-		case CBCentralManagerStateUnsupported:
+		case CBManagerStateUnsupported:
 			NSLog( @"CoreBluetooth BLE hardware is unsupported on this platform" );
 			break;
 
-		case CBCentralManagerStateResetting:
+		case CBManagerStateResetting:
 			NSLog( @"CoreBluetooth BLE manager is resetting" );
 			break;
 	}

+ 144 - 300
src/joystick/apple/SDL_mfijoystick.m

@@ -48,66 +48,18 @@
 static id connectObserver = nil;
 static id disconnectObserver = nil;
 
-#include <Availability.h>
 #include <objc/message.h>
 
-#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
  */
 @interface GCController (SDL)
-#if defined(SDL_PLATFORM_MACOS) && (__MAC_OS_X_VERSION_MAX_ALLOWED <= 101600)
-+ (BOOL)supportsHIDDevice:(IOHIDDeviceRef)device;
-#endif
-#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000))
-@property(nonatomic, readonly) NSString *productCategory;
-#endif
 #if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140500) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140500) || (__MAC_OS_X_VERSION_MAX_ALLOWED >= 110300))
 @property(class, nonatomic, readwrite) BOOL shouldMonitorBackgroundEvents;
 #endif
 @end
-@interface GCExtendedGamepad (SDL)
-#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 121000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 121000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1401000))
-@property(nonatomic, readonly, nullable) GCControllerButtonInput *leftThumbstickButton;
-@property(nonatomic, readonly, nullable) GCControllerButtonInput *rightThumbstickButton;
-#endif
-#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000))
-@property(nonatomic, readonly) GCControllerButtonInput *buttonMenu;
-@property(nonatomic, readonly, nullable) GCControllerButtonInput *buttonOptions;
-#endif
-#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140000) || (__MAC_OS_VERSION_MAX_ALLOWED > 1500000))
-@property(nonatomic, readonly, nullable) GCControllerButtonInput *buttonHome;
-#endif
-@end
-@interface GCMicroGamepad (SDL)
-#if !((__IPHONE_OS_VERSION_MAX_ALLOWED >= 130000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 130000) || (__MAC_OS_VERSION_MAX_ALLOWED >= 1500000))
-@property(nonatomic, readonly) GCControllerButtonInput *buttonMenu;
-#endif
-@end
-
-#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140000) || (__MAC_OS_VERSION_MAX_ALLOWED > 1500000) || (__MAC_OS_X_VERSION_MAX_ALLOWED > 101600)
-#define ENABLE_MFI_BATTERY
-#define ENABLE_MFI_RUMBLE
-#define ENABLE_MFI_LIGHT
-#define ENABLE_MFI_SENSORS
-#define ENABLE_MFI_SYSTEM_GESTURE_STATE
-#define ENABLE_PHYSICAL_INPUT_PROFILE
-#endif
 
-#ifdef ENABLE_MFI_RUMBLE
 #import <CoreHaptics/CoreHaptics.h>
-#endif
 
 #endif // SDL_JOYSTICK_MFI
 
@@ -234,7 +186,6 @@ static void CheckControllerSiriRemote(GCController *controller, int *is_siri_rem
     *is_siri_remote = 0;
 }
 
-#ifdef ENABLE_PHYSICAL_INPUT_PROFILE
 static bool ElementAlreadyHandled(SDL_JoystickDeviceItem *device, NSString *element, NSDictionary<NSString *, GCControllerElement *> *elements)
 {
     if ([element isEqualToString:@"Left Thumbstick Left"] ||
@@ -333,7 +284,6 @@ static bool ElementAlreadyHandled(SDL_JoystickDeviceItem *device, NSString *elem
     }
     return false;
 }
-#endif // ENABLE_PHYSICAL_INPUT_PROFILE
 
 static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller)
 {
@@ -366,7 +316,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
     NSLog(@"Product name: %@\n", controller.vendorName);
     NSLog(@"Product category: %@\n", controller.productCategory);
     NSLog(@"Elements available:\n");
-#ifdef ENABLE_PHYSICAL_INPUT_PROFILE
     if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
         NSDictionary<NSString *, GCControllerElement *> *elements = controller.physicalInputProfile.elements;
         for (id key in controller.physicalInputProfile.buttons) {
@@ -379,8 +328,7 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
             NSLog(@"\tHat: %@\n", key);
         }
     }
-#endif
-#endif
+#endif // DEBUG_CONTROLLER_PROFILE
 
     device->is_xbox = IsControllerXbox(controller);
     device->is_ps4 = IsControllerPS4(controller);
@@ -416,7 +364,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
         return false;
     }
 
-#ifdef ENABLE_PHYSICAL_INPUT_PROFILE
     if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
         if (controller.physicalInputProfile.buttons[GCInputDualShockTouchpadButton] != nil) {
             device->has_dualshock_touchpad = TRUE;
@@ -428,7 +375,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
             device->has_xbox_share_button = TRUE;
         }
     }
-#endif // ENABLE_PHYSICAL_INPUT_PROFILE
 
     if (device->is_backbone_one) {
         vendor = USB_VENDOR_BACKBONE;
@@ -473,20 +419,14 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
     } else if (device->is_switch_joyconR) {
         vendor = USB_VENDOR_NINTENDO;
         product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT;
-#ifdef ENABLE_PHYSICAL_INPUT_PROFILE
     } else if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
         vendor = USB_VENDOR_APPLE;
         product = 4;
         subtype = 4;
-#endif
     } else if (controller.extendedGamepad) {
         vendor = USB_VENDOR_APPLE;
         product = 1;
         subtype = 1;
-    } else if (controller.gamepad) {
-        vendor = USB_VENDOR_APPLE;
-        product = 2;
-        subtype = 2;
 #ifdef SDL_PLATFORM_TVOS
     } else if (controller.microGamepad) {
         vendor = USB_VENDOR_APPLE;
@@ -502,7 +442,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
         return false;
     }
 
-#ifdef ENABLE_PHYSICAL_INPUT_PROFILE
     if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
         NSDictionary<NSString *, GCControllerElement *> *elements = controller.physicalInputProfile.elements;
 
@@ -558,9 +497,7 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
             device->pause_button_index = (int)[device->buttons indexOfObject:GCInputButtonMenu];
         }
 #endif
-    } else
-#endif
-    if (controller.extendedGamepad) {
+    } else if (controller.extendedGamepad) {
         GCExtendedGamepad *gamepad = controller.extendedGamepad;
         int nbuttons = 0;
         BOOL has_direct_menu = FALSE;
@@ -612,24 +549,6 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
         device->naxes = 6; // 2 thumbsticks and 2 triggers
         device->nhats = 1; // d-pad
         device->nbuttons = nbuttons;
-
-    } else if (controller.gamepad) {
-        int nbuttons = 0;
-
-        // These buttons are part of the original MFi spec
-        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_SOUTH);
-        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_EAST);
-        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_WEST);
-        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_NORTH);
-        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_LEFT_SHOULDER);
-        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER);
-        device->button_mask |= (1 << SDL_GAMEPAD_BUTTON_START);
-        nbuttons += 7;
-        device->pause_button_index = (nbuttons - 1);
-
-        device->naxes = 0; // no traditional analog inputs
-        device->nhats = 1; // d-pad
-        device->nbuttons = nbuttons;
     }
 #ifdef SDL_PLATFORM_TVOS
     else if (controller.microGamepad) {
@@ -677,7 +596,7 @@ static bool IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle
 }
 #endif // SDL_JOYSTICK_MFI
 
-#if defined(SDL_JOYSTICK_MFI)
+#ifdef SDL_JOYSTICK_MFI
 static void IOS_AddJoystickDevice(GCController *controller)
 {
     SDL_JoystickDeviceItem *device = deviceList;
@@ -975,7 +894,6 @@ static bool IOS_JoystickOpen(SDL_Joystick *joystick, int device_index)
             };
         }
 
-#ifdef ENABLE_MFI_SENSORS
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
             GCController *controller = joystick->hwdata->controller;
             GCMotion *motion = controller.motion;
@@ -986,9 +904,7 @@ static bool IOS_JoystickOpen(SDL_Joystick *joystick, int device_index)
                 SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 0.0f);
             }
         }
-#endif // ENABLE_MFI_SENSORS
 
-#ifdef ENABLE_MFI_SYSTEM_GESTURE_STATE
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
             GCController *controller = joystick->hwdata->controller;
             for (id key in controller.physicalInputProfile.buttons) {
@@ -998,17 +914,13 @@ static bool IOS_JoystickOpen(SDL_Joystick *joystick, int device_index)
                 }
             }
         }
-#endif // ENABLE_MFI_SYSTEM_GESTURE_STATE
 
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
             GCController *controller = device->controller;
-#ifdef ENABLE_MFI_LIGHT
             if (controller.light) {
                 SDL_SetBooleanProperty(SDL_GetJoystickProperties(joystick), SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, true);
             }
-#endif
 
-#ifdef ENABLE_MFI_RUMBLE
             if (controller.haptics) {
                 for (GCHapticsLocality locality in controller.haptics.supportedLocalities) {
                     if ([locality isEqualToString:GCHapticsLocalityHandles]) {
@@ -1018,7 +930,6 @@ static bool IOS_JoystickOpen(SDL_Joystick *joystick, int device_index)
                     }
                 }
             }
-#endif
         }
 #endif // SDL_JOYSTICK_MFI
     }
@@ -1064,7 +975,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
         int i;
         Uint64 timestamp = SDL_GetTicksNS();
 
-#if defined(DEBUG_CONTROLLER_STATE) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
+#ifdef DEBUG_CONTROLLER_STATE
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
             if (controller.physicalInputProfile) {
                 for (id key in controller.physicalInputProfile.buttons) {
@@ -1091,7 +1002,6 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
         }
 #endif // DEBUG_CONTROLLER_STATE
 
-#ifdef ENABLE_PHYSICAL_INPUT_PROFILE
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
             NSDictionary<NSString *, GCControllerElement *> *elements = controller.physicalInputProfile.elements;
             NSDictionary<NSString *, GCControllerButtonInput *> *buttons = controller.physicalInputProfile.buttons;
@@ -1118,9 +1028,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
                 }
                 SDL_SendJoystickButton(timestamp, joystick, button++, down);
             }
-        } else
-#endif
-        if (controller.extendedGamepad) {
+        } else if (controller.extendedGamepad) {
             bool isstack;
             GCExtendedGamepad *gamepad = controller.extendedGamepad;
 
@@ -1185,33 +1093,6 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
                 SDL_SendJoystickButton(timestamp, joystick, i, buttons[i]);
             }
 
-            SDL_small_free(buttons, isstack);
-        } else if (controller.gamepad) {
-            bool isstack;
-            GCGamepad *gamepad = controller.gamepad;
-
-            // Button order matches the XInput Windows mappings.
-            bool *buttons = SDL_small_alloc(bool, joystick->nbuttons, &isstack);
-            int button_count = 0;
-
-            if (buttons == NULL) {
-                return;
-            }
-
-            buttons[button_count++] = gamepad.buttonA.isPressed;
-            buttons[button_count++] = gamepad.buttonB.isPressed;
-            buttons[button_count++] = gamepad.buttonX.isPressed;
-            buttons[button_count++] = gamepad.buttonY.isPressed;
-            buttons[button_count++] = gamepad.leftShoulder.isPressed;
-            buttons[button_count++] = gamepad.rightShoulder.isPressed;
-            buttons[button_count++] = (device->pause_button_pressed > 0);
-
-            hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad);
-
-            for (i = 0; i < button_count; i++) {
-                SDL_SendJoystickButton(timestamp, joystick, i, buttons[i]);
-            }
-
             SDL_small_free(buttons, isstack);
         }
 #ifdef SDL_PLATFORM_TVOS
@@ -1251,7 +1132,6 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
             }
         }
 
-#ifdef ENABLE_PHYSICAL_INPUT_PROFILE
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
             if (device->has_dualshock_touchpad) {
                 GCControllerDirectionPad *dpad;
@@ -1271,33 +1151,29 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
                 }
             }
         }
-#endif // ENABLE_PHYSICAL_INPUT_PROFILE
 
-#ifdef ENABLE_MFI_SENSORS
-            if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
-                GCMotion *motion = controller.motion;
-                if (motion && motion.sensorsActive) {
-                    float data[3];
-
-                    if (motion.hasRotationRate) {
-                        GCRotationRate rate = motion.rotationRate;
-                        data[0] = rate.x;
-                        data[1] = rate.z;
-                        data[2] = -rate.y;
-                        SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, timestamp, data, 3);
-                    }
-                    if (motion.hasGravityAndUserAcceleration) {
-                        GCAcceleration accel = motion.acceleration;
-                        data[0] = -accel.x * SDL_STANDARD_GRAVITY;
-                        data[1] = -accel.y * SDL_STANDARD_GRAVITY;
-                        data[2] = -accel.z * SDL_STANDARD_GRAVITY;
-                        SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_ACCEL, timestamp, data, 3);
-                    }
+        if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
+            GCMotion *motion = controller.motion;
+            if (motion && motion.sensorsActive) {
+                float data[3];
+
+                if (motion.hasRotationRate) {
+                    GCRotationRate rate = motion.rotationRate;
+                    data[0] = rate.x;
+                    data[1] = rate.z;
+                    data[2] = -rate.y;
+                    SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, timestamp, data, 3);
+                }
+                if (motion.hasGravityAndUserAcceleration) {
+                    GCAcceleration accel = motion.acceleration;
+                    data[0] = -accel.x * SDL_STANDARD_GRAVITY;
+                    data[1] = -accel.y * SDL_STANDARD_GRAVITY;
+                    data[2] = -accel.z * SDL_STANDARD_GRAVITY;
+                    SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_ACCEL, timestamp, data, 3);
                 }
             }
-#endif // ENABLE_MFI_SENSORS
+        }
 
-#ifdef ENABLE_MFI_BATTERY
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
             GCDeviceBattery *battery = controller.battery;
             if (battery) {
@@ -1321,13 +1197,10 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
                 SDL_SendJoystickPowerInfo(joystick, state, percent);
             }
         }
-#endif // ENABLE_MFI_BATTERY
     }
 #endif // SDL_JOYSTICK_MFI
 }
 
-#ifdef ENABLE_MFI_RUMBLE
-
 @interface SDL3_RumbleMotor : NSObject
 @property(nonatomic, strong) CHHapticEngine *engine API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0));
 @property(nonatomic, strong) id<CHHapticPatternPlayer> player API_AVAILABLE(macos(10.16), ios(13.0), tvos(14.0));
@@ -1522,11 +1395,8 @@ static SDL3_RumbleContext *IOS_JoystickInitRumble(GCController *controller)
     return nil;
 }
 
-#endif // ENABLE_MFI_RUMBLE
-
 static bool IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
 {
-#ifdef ENABLE_MFI_RUMBLE
     SDL_JoystickDeviceItem *device = joystick->hwdata;
 
     if (device == NULL) {
@@ -1548,14 +1418,10 @@ static bool IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumb
     } else {
         return SDL_Unsupported();
     }
-#else
-    return SDL_Unsupported();
-#endif
 }
 
 static bool IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
 {
-#ifdef ENABLE_MFI_RUMBLE
     SDL_JoystickDeviceItem *device = joystick->hwdata;
 
     if (device == NULL) {
@@ -1577,14 +1443,10 @@ static bool IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumbl
     } else {
         return SDL_Unsupported();
     }
-#else
-    return SDL_Unsupported();
-#endif
 }
 
 static bool IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
 {
-#ifdef ENABLE_MFI_LIGHT
     @autoreleasepool {
         SDL_JoystickDeviceItem *device = joystick->hwdata;
 
@@ -1603,7 +1465,6 @@ static bool IOS_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, U
             }
         }
     }
-#endif // ENABLE_MFI_LIGHT
 
     return SDL_Unsupported();
 }
@@ -1615,7 +1476,6 @@ static bool IOS_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int
 
 static bool IOS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled)
 {
-#ifdef ENABLE_MFI_SENSORS
     @autoreleasepool {
         SDL_JoystickDeviceItem *device = joystick->hwdata;
 
@@ -1632,7 +1492,6 @@ static bool IOS_JoystickSetSensorsEnabled(SDL_Joystick *joystick, bool enabled)
             }
         }
     }
-#endif // ENABLE_MFI_SENSORS
 
     return SDL_Unsupported();
 }
@@ -1661,7 +1520,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick)
     device->joystick = NULL;
 
     @autoreleasepool {
-#ifdef ENABLE_MFI_RUMBLE
         if (device->rumble) {
             SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble;
 
@@ -1669,7 +1527,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick)
             CFRelease(device->rumble);
             device->rumble = NULL;
         }
-#endif // ENABLE_MFI_RUMBLE
 
         if (device->controller) {
 #ifdef SDL_JOYSTICK_MFI
@@ -1677,7 +1534,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick)
             controller.controllerPausedHandler = nil;
             controller.playerIndex = -1;
 
-#ifdef ENABLE_MFI_SYSTEM_GESTURE_STATE
             if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
                 for (id key in controller.physicalInputProfile.buttons) {
                     GCControllerButtonInput *button = controller.physicalInputProfile.buttons[key];
@@ -1686,8 +1542,6 @@ static void IOS_JoystickClose(SDL_Joystick *joystick)
                     }
                 }
             }
-#endif // ENABLE_MFI_SYSTEM_GESTURE_STATE
-
 #endif // SDL_JOYSTICK_MFI
         }
     }
@@ -1728,7 +1582,6 @@ static void IOS_JoystickQuit(void)
 
 static bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
 {
-#ifdef ENABLE_PHYSICAL_INPUT_PROFILE
     SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index);
     if (device == NULL) {
         return false;
@@ -1861,8 +1714,6 @@ static bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *
 
         return true;
     }
-#endif // ENABLE_PHYSICAL_INPUT_PROFILE
-
     return false;
 }
 
@@ -1888,7 +1739,7 @@ bool IOS_SupportedHIDDevice(IOHIDDeviceRef device)
 }
 #endif
 
-#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
+#ifdef SDL_JOYSTICK_MFI
 /* NOLINTNEXTLINE(readability-non-const-parameter): getCString takes a non-const char* */
 static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char *name)
 {
@@ -1909,132 +1760,126 @@ static GCControllerDirectionPad *GetDirectionalPadForController(GCController *co
         return controller.extendedGamepad.dpad;
     }
 
-    if (controller.gamepad) {
-        return controller.gamepad.dpad;
-    }
-
     if (controller.microGamepad) {
         return controller.microGamepad.dpad;
     }
 
     return nil;
 }
-#endif // SDL_JOYSTICK_MFI && ENABLE_PHYSICAL_INPUT_PROFILE
+#endif // SDL_JOYSTICK_MFI
 
 const char *IOS_GetAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
 {
     char elementName[256];
     elementName[0] = '\0';
 
-#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
+#ifdef SDL_JOYSTICK_MFI
     if (gamepad && SDL_GetGamepadJoystick(gamepad)->driver == &SDL_IOS_JoystickDriver) {
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
             GCController *controller = SDL_GetGamepadJoystick(gamepad)->hwdata->controller;
-            if ([controller respondsToSelector:@selector(physicalInputProfile)]) {
-                NSDictionary<NSString *, GCControllerElement *> *elements = controller.physicalInputProfile.elements;
-                switch (button) {
-                case SDL_GAMEPAD_BUTTON_SOUTH:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputButtonA], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_EAST:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputButtonB], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_WEST:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputButtonX], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_NORTH:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputButtonY], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_BACK:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputButtonOptions], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_GUIDE:
-                    GetAppleSFSymbolsNameForElement(elements[@"Button Home"], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_START:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputButtonMenu], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_LEFT_STICK:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstickButton], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_RIGHT_STICK:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstickButton], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_LEFT_SHOULDER:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputLeftShoulder], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputRightShoulder], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_DPAD_UP:
-                {
-                    GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
-                    if (dpad) {
-                        GetAppleSFSymbolsNameForElement(dpad.up, elementName);
-                        if (SDL_strlen(elementName) == 0) {
-                            SDL_strlcpy(elementName, "dpad.up.fill", sizeof(elementName));
-                        }
+            NSDictionary<NSString *, GCControllerElement *> *elements = controller.physicalInputProfile.elements;
+            switch (button) {
+            case SDL_GAMEPAD_BUTTON_SOUTH:
+                GetAppleSFSymbolsNameForElement(elements[GCInputButtonA], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_EAST:
+                GetAppleSFSymbolsNameForElement(elements[GCInputButtonB], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_WEST:
+                GetAppleSFSymbolsNameForElement(elements[GCInputButtonX], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_NORTH:
+                GetAppleSFSymbolsNameForElement(elements[GCInputButtonY], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_BACK:
+                GetAppleSFSymbolsNameForElement(elements[GCInputButtonOptions], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_GUIDE:
+                GetAppleSFSymbolsNameForElement(elements[@"Button Home"], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_START:
+                GetAppleSFSymbolsNameForElement(elements[GCInputButtonMenu], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_LEFT_STICK:
+                GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstickButton], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_RIGHT_STICK:
+                GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstickButton], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_LEFT_SHOULDER:
+                GetAppleSFSymbolsNameForElement(elements[GCInputLeftShoulder], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER:
+                GetAppleSFSymbolsNameForElement(elements[GCInputRightShoulder], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_DPAD_UP:
+            {
+                GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
+                if (dpad) {
+                    GetAppleSFSymbolsNameForElement(dpad.up, elementName);
+                    if (SDL_strlen(elementName) == 0) {
+                        SDL_strlcpy(elementName, "dpad.up.fill", sizeof(elementName));
                     }
-                    break;
                 }
-                case SDL_GAMEPAD_BUTTON_DPAD_DOWN:
-                {
-                    GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
-                    if (dpad) {
-                        GetAppleSFSymbolsNameForElement(dpad.down, elementName);
-                        if (SDL_strlen(elementName) == 0) {
-                            SDL_strlcpy(elementName, "dpad.down.fill", sizeof(elementName));
-                        }
+                break;
+            }
+            case SDL_GAMEPAD_BUTTON_DPAD_DOWN:
+            {
+                GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
+                if (dpad) {
+                    GetAppleSFSymbolsNameForElement(dpad.down, elementName);
+                    if (SDL_strlen(elementName) == 0) {
+                        SDL_strlcpy(elementName, "dpad.down.fill", sizeof(elementName));
                     }
-                    break;
                 }
-                case SDL_GAMEPAD_BUTTON_DPAD_LEFT:
-                {
-                    GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
-                    if (dpad) {
-                        GetAppleSFSymbolsNameForElement(dpad.left, elementName);
-                        if (SDL_strlen(elementName) == 0) {
-                            SDL_strlcpy(elementName, "dpad.left.fill", sizeof(elementName));
-                        }
+                break;
+            }
+            case SDL_GAMEPAD_BUTTON_DPAD_LEFT:
+            {
+                GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
+                if (dpad) {
+                    GetAppleSFSymbolsNameForElement(dpad.left, elementName);
+                    if (SDL_strlen(elementName) == 0) {
+                        SDL_strlcpy(elementName, "dpad.left.fill", sizeof(elementName));
                     }
-                    break;
                 }
-                case SDL_GAMEPAD_BUTTON_DPAD_RIGHT:
-                {
-                    GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
-                    if (dpad) {
-                        GetAppleSFSymbolsNameForElement(dpad.right, elementName);
-                        if (SDL_strlen(elementName) == 0) {
-                            SDL_strlcpy(elementName, "dpad.right.fill", sizeof(elementName));
-                        }
+                break;
+            }
+            case SDL_GAMEPAD_BUTTON_DPAD_RIGHT:
+            {
+                GCControllerDirectionPad *dpad = GetDirectionalPadForController(controller);
+                if (dpad) {
+                    GetAppleSFSymbolsNameForElement(dpad.right, elementName);
+                    if (SDL_strlen(elementName) == 0) {
+                        SDL_strlcpy(elementName, "dpad.right.fill", sizeof(elementName));
                     }
-                    break;
-                }
-                case SDL_GAMEPAD_BUTTON_MISC1:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleOne], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_LEFT_PADDLE1:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleThree], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleTwo], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_LEFT_PADDLE2:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleFour], elementName);
-                    break;
-                case SDL_GAMEPAD_BUTTON_TOUCHPAD:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName);
-                    break;
-                default:
-                    break;
                 }
+                break;
+            }
+            case SDL_GAMEPAD_BUTTON_MISC1:
+                GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1:
+                GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleOne], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_LEFT_PADDLE1:
+                GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleThree], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2:
+                GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleTwo], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_LEFT_PADDLE2:
+                GetAppleSFSymbolsNameForElement(elements[GCInputXboxPaddleFour], elementName);
+                break;
+            case SDL_GAMEPAD_BUTTON_TOUCHPAD:
+                GetAppleSFSymbolsNameForElement(elements[GCInputDualShockTouchpadButton], elementName);
+                break;
+            default:
+                break;
             }
         }
     }
-#endif
+#endif // SDL_JOYSTICK_MFI
 
     return *elementName ? SDL_GetPersistentString(elementName) : NULL;
 }
@@ -2044,38 +1889,37 @@ const char *IOS_GetAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAx
     char elementName[256];
     elementName[0] = '\0';
 
-#if defined(SDL_JOYSTICK_MFI) && defined(ENABLE_PHYSICAL_INPUT_PROFILE)
+#ifdef SDL_JOYSTICK_MFI
     if (gamepad && SDL_GetGamepadJoystick(gamepad)->driver == &SDL_IOS_JoystickDriver) {
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
             GCController *controller = SDL_GetGamepadJoystick(gamepad)->hwdata->controller;
-            if ([controller respondsToSelector:@selector(physicalInputProfile)]) {
-                NSDictionary<NSString *, GCControllerElement *> *elements = controller.physicalInputProfile.elements;
-                switch (axis) {
-                case SDL_GAMEPAD_AXIS_LEFTX:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName);
-                    break;
-                case SDL_GAMEPAD_AXIS_LEFTY:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName);
-                    break;
-                case SDL_GAMEPAD_AXIS_RIGHTX:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName);
-                    break;
-                case SDL_GAMEPAD_AXIS_RIGHTY:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName);
-                    break;
-                case SDL_GAMEPAD_AXIS_LEFT_TRIGGER:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputLeftTrigger], elementName);
-                    break;
-                case SDL_GAMEPAD_AXIS_RIGHT_TRIGGER:
-                    GetAppleSFSymbolsNameForElement(elements[GCInputRightTrigger], elementName);
-                    break;
-                default:
-                    break;
-                }
+            NSDictionary<NSString *, GCControllerElement *> *elements = controller.physicalInputProfile.elements;
+            switch (axis) {
+            case SDL_GAMEPAD_AXIS_LEFTX:
+                GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName);
+                break;
+            case SDL_GAMEPAD_AXIS_LEFTY:
+                GetAppleSFSymbolsNameForElement(elements[GCInputLeftThumbstick], elementName);
+                break;
+            case SDL_GAMEPAD_AXIS_RIGHTX:
+                GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName);
+                break;
+            case SDL_GAMEPAD_AXIS_RIGHTY:
+                GetAppleSFSymbolsNameForElement(elements[GCInputRightThumbstick], elementName);
+                break;
+            case SDL_GAMEPAD_AXIS_LEFT_TRIGGER:
+                GetAppleSFSymbolsNameForElement(elements[GCInputLeftTrigger], elementName);
+                break;
+            case SDL_GAMEPAD_AXIS_RIGHT_TRIGGER:
+                GetAppleSFSymbolsNameForElement(elements[GCInputRightTrigger], elementName);
+                break;
+            default:
+                break;
             }
         }
     }
-#endif
+#endif // SDL_JOYSTICK_MFI
+
     return *elementName ? SDL_GetPersistentString(elementName) : NULL;
 }
 

+ 1 - 7
src/misc/ios/SDL_sysurl.m

@@ -34,13 +34,7 @@ bool SDL_SYS_OpenURL(const char *url)
         if (![[UIApplication sharedApplication] canOpenURL:nsurl]) {
             return SDL_SetError("No handler registered for this type of URL");
         }
-        if (@available(iOS 10.0, tvOS 10.0, *)) {
-            [[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:^(BOOL success) {}];
-        } else {
-            #ifndef SDL_PLATFORM_VISIONOS   // Fallback is never available in any version of VisionOS (but correct API always is).
-            [[UIApplication sharedApplication] openURL:nsurl];
-            #endif
-        }
+        [[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:^(BOOL success) {}];
         return true;
     }
 }

+ 27 - 71
src/render/metal/SDL_render_metal.m

@@ -25,7 +25,6 @@
 #include "../SDL_sysrender.h"
 #include "../../video/SDL_pixels_c.h"
 
-#include <Availability.h>
 #import <CoreVideo/CoreVideo.h>
 #import <Metal/Metal.h>
 #import <QuartzCore/CAMetalLayer.h>
@@ -171,18 +170,6 @@ typedef struct METAL_ShaderPipelines
 @implementation SDL3METAL_TextureData
 @end
 
-static bool IsMetalAvailable()
-{
-#if (defined(SDL_PLATFORM_MACOS) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100))
-    // this checks a weak symbol.
-    if (MTLCreateSystemDefaultDevice == NULL) { // probably on 10.10 or lower.
-        SDL_SetError("Metal framework not available on this system");
-        return false;
-    }
-#endif
-    return true;
-}
-
 static const MTLBlendOperation invalidBlendOperation = (MTLBlendOperation)0xFFFFFFFF;
 static const MTLBlendFactor invalidBlendFactor = (MTLBlendFactor)0xFFFFFFFF;
 
@@ -690,19 +677,14 @@ static bool METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
                                                                        height:(NSUInteger)texture->h
                                                                     mipmapped:NO];
 
-        // Not available in iOS 8.
-        if ([mtltexdesc respondsToSelector:@selector(usage)]) {
-            if (texture->access == SDL_TEXTUREACCESS_TARGET) {
-                mtltexdesc.usage = MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget;
-            } else {
-                mtltexdesc.usage = MTLTextureUsageShaderRead;
-            }
+        if (texture->access == SDL_TEXTUREACCESS_TARGET) {
+            mtltexdesc.usage = MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget;
+        } else {
+            mtltexdesc.usage = MTLTextureUsageShaderRead;
         }
 
         if (surface) {
-            if (@available(iOS 11.0, tvOS 11.0, *)) {
-                mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:0];
-            }
+            mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:0];
         } else {
             mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
         }
@@ -733,9 +715,7 @@ static bool METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD
 
         if (yuv || nv12) {
             if (surface) {
-                if (@available(iOS 11.0, tvOS 11.0, *)) {
-                    mtltextureUv = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:1];
-                }
+                mtltextureUv = [data.mtldevice newTextureWithDescriptor:mtltexdesc iosurface:surface plane:1];
             } else {
                 mtltextureUv = [data.mtldevice newTextureWithDescriptor:mtltexdesc];
             }
@@ -787,11 +767,7 @@ static void METAL_UploadTextureData(id<MTLTexture> texture, SDL_Rect rect, int s
 
 static MTLStorageMode METAL_GetStorageMode(id<MTLResource> resource)
 {
-    // iOS 8 does not have this method.
-    if ([resource respondsToSelector:@selector(storageMode)]) {
-        return resource.storageMode;
-    }
-    return MTLStorageModeShared;
+    return resource.storageMode;
 }
 
 static bool METAL_UpdateTextureInternal(SDL_Renderer *renderer, SDL3METAL_TextureData *texturedata,
@@ -1845,28 +1821,27 @@ static void *METAL_GetMetalCommandEncoder(SDL_Renderer *renderer)
 
 static bool METAL_SetVSync(SDL_Renderer *renderer, const int vsync)
 {
-#if (defined(SDL_PLATFORM_MACOS) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST
-    if (@available(macOS 10.13, *)) {
-        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
-        switch (vsync) {
-        case 0:
-            data.mtllayer.displaySyncEnabled = NO;
-            break;
-        case 1:
-            data.mtllayer.displaySyncEnabled = YES;
-            break;
-        default:
-            return SDL_Unsupported();
-        }
-        return true;
+#if defined(SDL_PLATFORM_MACOS) || TARGET_OS_MACCATALYST
+    SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
+    switch (vsync) {
+    case 0:
+        data.mtllayer.displaySyncEnabled = NO;
+        break;
+    case 1:
+        data.mtllayer.displaySyncEnabled = YES;
+        break;
+    default:
+        return SDL_Unsupported();
     }
-#endif
+    return true;
+#else
     switch (vsync) {
     case 1:
         return true;
     default:
         return SDL_Unsupported();
     }
+#endif
 }
 
 static SDL_MetalView GetWindowView(SDL_Window *window)
@@ -1961,10 +1936,6 @@ static bool METAL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL
 
         const size_t YCbCr_shader_matrix_size = 4 * 4 * sizeof(float);
 
-        if (!IsMetalAvailable()) {
-            return false;
-        }
-
         SDL_SetupRendererColorspace(renderer, create_props);
 
 #ifndef SDL_PLATFORM_TVOS
@@ -2187,10 +2158,8 @@ static bool METAL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL
         SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_NV21);
         SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_P010);
 
-#if (defined(SDL_PLATFORM_MACOS) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST
-        if (@available(macOS 10.13, *)) {
-            data.mtllayer.displaySyncEnabled = NO;
-        }
+#if defined(SDL_PLATFORM_MACOS) || TARGET_OS_MACCATALYST
+        data.mtllayer.displaySyncEnabled = NO;
 #endif
 
         // https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
@@ -2199,28 +2168,15 @@ static bool METAL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL
         maxtexsize = 16384;
 #elif defined(SDL_PLATFORM_TVOS)
         maxtexsize = 8192;
-#ifdef __TVOS_11_0
-        if (@available(tvOS 11.0, *)) {
-            if ([mtldevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]) {
-                maxtexsize = 16384;
-            }
+        if ([mtldevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]) {
+            maxtexsize = 16384;
         }
-#endif
 #else
-#ifdef __IPHONE_11_0
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunguarded-availability-new"
         if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1]) {
             maxtexsize = 16384;
-        } else
-#pragma clang diagnostic pop
-#endif
-#ifdef __IPHONE_10_0
-            if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) {
+        } else if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) {
             maxtexsize = 16384;
-        } else
-#endif
-            if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v2] || [mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v2]) {
+        } else if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v2] || [mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v2]) {
             maxtexsize = 8192;
         } else {
             maxtexsize = 4096;

+ 0 - 4
src/video/cocoa/SDL_cocoaclipboard.m

@@ -28,10 +28,6 @@
 
 #include <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 101300
-typedef NSString *NSPasteboardType; // Defined in macOS 10.13+
-#endif
-
 @interface Cocoa_PasteboardDataProvider : NSObject<NSPasteboardItemDataProvider>
 {
     SDL_ClipboardDataCallback m_callback;

+ 0 - 4
src/video/cocoa/SDL_cocoaevents.m

@@ -25,10 +25,6 @@
 #include "SDL_cocoavideo.h"
 #include "../../events/SDL_events_c.h"
 
-#ifndef MAC_OS_X_VERSION_10_12
-#define NSEventTypeApplicationDefined NSApplicationDefined
-#endif
-
 static SDL_Window *FindSDLWindowForNSWindow(NSWindow *win)
 {
     SDL_Window *sdlwindow = NULL;

+ 0 - 8
src/video/cocoa/SDL_cocoamodes.m

@@ -32,12 +32,6 @@
 #include <CoreVideo/CVBase.h>
 #include <CoreVideo/CVDisplayLink.h>
 
-// This gets us MAC_OS_X_VERSION_MIN_REQUIRED...
-#include <AvailabilityMacros.h>
-
-#ifndef MAC_OS_X_VERSION_10_13
-#define NSAppKitVersionNumber10_12 1504
-#endif
 #if (IOGRAPHICSTYPES_REV < 40)
 #define kDisplayModeNativeFlag 0x02000000
 #endif
@@ -307,7 +301,6 @@ static void Cocoa_GetHDRProperties(CGDirectDisplayID displayID, SDL_HDROutputPro
     HDR->SDR_white_level = 1.0f;
     HDR->HDR_headroom = 1.0f;
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 // Added in the 10.15 SDK
     if (@available(macOS 10.15, *)) {
         NSScreen *screen = GetNSScreenForDisplayID(displayID);
         if (screen) {
@@ -318,7 +311,6 @@ static void Cocoa_GetHDRProperties(CGDirectDisplayID displayID, SDL_HDROutputPro
             }
         }
     }
-#endif
 }
 
 

+ 0 - 58
src/video/cocoa/SDL_cocoavideo.h

@@ -40,59 +40,6 @@
 #include "SDL_cocoawindow.h"
 #include "SDL_cocoapen.h"
 
-#ifndef MAC_OS_X_VERSION_10_12
-#define DECLARE_EVENT(name) static const NSEventType NSEventType##name = NS##name
-DECLARE_EVENT(LeftMouseDown);
-DECLARE_EVENT(LeftMouseUp);
-DECLARE_EVENT(RightMouseDown);
-DECLARE_EVENT(RightMouseUp);
-DECLARE_EVENT(OtherMouseDown);
-DECLARE_EVENT(OtherMouseUp);
-DECLARE_EVENT(MouseMoved);
-DECLARE_EVENT(LeftMouseDragged);
-DECLARE_EVENT(RightMouseDragged);
-DECLARE_EVENT(OtherMouseDragged);
-DECLARE_EVENT(ScrollWheel);
-DECLARE_EVENT(KeyDown);
-DECLARE_EVENT(KeyUp);
-DECLARE_EVENT(FlagsChanged);
-#undef DECLARE_EVENT
-
-static const NSEventMask NSEventMaskAny = NSAnyEventMask;
-
-#define DECLARE_MODIFIER_FLAG(name) static const NSUInteger NSEventModifierFlag##name = NS##name##KeyMask
-DECLARE_MODIFIER_FLAG(Shift);
-DECLARE_MODIFIER_FLAG(Control);
-DECLARE_MODIFIER_FLAG(Command);
-DECLARE_MODIFIER_FLAG(NumericPad);
-DECLARE_MODIFIER_FLAG(Help);
-DECLARE_MODIFIER_FLAG(Function);
-#undef DECLARE_MODIFIER_FLAG
-static const NSUInteger NSEventModifierFlagCapsLock = NSAlphaShiftKeyMask;
-static const NSUInteger NSEventModifierFlagOption = NSAlternateKeyMask;
-
-#define DECLARE_WINDOW_MASK(name) static const unsigned int NSWindowStyleMask##name = NS##name##WindowMask
-DECLARE_WINDOW_MASK(Borderless);
-DECLARE_WINDOW_MASK(Titled);
-DECLARE_WINDOW_MASK(Closable);
-DECLARE_WINDOW_MASK(Miniaturizable);
-DECLARE_WINDOW_MASK(Resizable);
-DECLARE_WINDOW_MASK(TexturedBackground);
-DECLARE_WINDOW_MASK(UnifiedTitleAndToolbar);
-DECLARE_WINDOW_MASK(FullScreen);
-/*DECLARE_WINDOW_MASK(FullSizeContentView);*/ // Not used, fails compile on older SDKs
-static const unsigned int NSWindowStyleMaskUtilityWindow = NSUtilityWindowMask;
-static const unsigned int NSWindowStyleMaskDocModalWindow = NSDocModalWindowMask;
-static const unsigned int NSWindowStyleMaskHUDWindow = NSHUDWindowMask;
-#undef DECLARE_WINDOW_MASK
-
-#define DECLARE_ALERT_STYLE(name) static const NSUInteger NSAlertStyle##name = NS##name##AlertStyle
-DECLARE_ALERT_STYLE(Warning);
-DECLARE_ALERT_STYLE(Informational);
-DECLARE_ALERT_STYLE(Critical);
-#undef DECLARE_ALERT_STYLE
-#endif
-
 // Private display data
 
 @class SDL3TranslatorResponder;
@@ -112,9 +59,4 @@ DECLARE_ALERT_STYLE(Critical);
 extern SDL_SystemTheme Cocoa_GetSystemTheme(void);
 extern NSImage *Cocoa_CreateImage(SDL_Surface *surface);
 
-// Fix build with the 10.11 SDK
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
-#define NSEventSubtypeMouseEvent NSMouseEventSubtype
-#endif
-
 #endif // SDL_cocoavideo_h_

+ 1 - 3
src/video/cocoa/SDL_cocoavideo.m

@@ -245,15 +245,13 @@ void Cocoa_VideoQuit(SDL_VideoDevice *_this)
 // This function assumes that it's called from within an autorelease pool
 SDL_SystemTheme Cocoa_GetSystemTheme(void)
 {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 // Added in the 10.14.0 SDK.
-    if ([[NSApplication sharedApplication] respondsToSelector:@selector(effectiveAppearance)]) {
+    if (@available(macOS 10.14, *)) {
         NSAppearance* appearance = [[NSApplication sharedApplication] effectiveAppearance];
 
         if ([appearance.name containsString: @"Dark"]) {
             return SDL_SYSTEM_THEME_DARK;
         }
     }
-#endif
     return SDL_SYSTEM_THEME_LIGHT;
 }
 

+ 11 - 29
src/video/cocoa/SDL_cocoawindow.m

@@ -22,10 +22,6 @@
 
 #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.
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1090
-
 #include <float.h> // For FLT_MAX
 
 #include "../../events/SDL_dropevents_c.h"
@@ -71,10 +67,6 @@
 @end
 
 @interface NSWindow (SDL)
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 // Added in the 10.10 SDK
-@property(readonly) NSRect contentLayoutRect;
-#endif
-
 // This is available as of 10.13.2, but isn't in public headers
 @property(nonatomic) NSRect mouseConfinementRect;
 @end
@@ -1944,20 +1936,16 @@ static void Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL
          */
         SDL_Window *window = NULL;
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101202 // Added in the 10.12.2 SDK.
-        if ([touch respondsToSelector:@selector(type)]) {
-            /* TODO: Before implementing direct touch support here, we need to
-             * figure out whether the OS generates mouse events from them on its
-             * own. If it does, we should prevent SendTouch from generating
-             * synthetic mouse events for these touches itself (while also
-             * sending a window.) It will also need to use normalized window-
-             * relative coordinates via [touch locationInView:].
-             */
-            if ([touch type] == NSTouchTypeDirect) {
-                continue;
-            }
+        /* TODO: Before implementing direct touch support here, we need to
+         * figure out whether the OS generates mouse events from them on its
+         * own. If it does, we should prevent SendTouch from generating
+         * synthetic mouse events for these touches itself (while also
+         * sending a window.) It will also need to use normalized window-
+         * relative coordinates via [touch locationInView:].
+         */
+        if ([touch type] == NSTouchTypeDirect) {
+            continue;
         }
-#endif
 
         if (SDL_AddTouch(touchId, devtype, "") < 0) {
             return;
@@ -2301,12 +2289,7 @@ bool Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properti
 
             [nswindow setColorSpace:[NSColorSpace sRGBColorSpace]];
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 // Added in the 10.12.0 SDK.
-            // By default, don't allow users to make our window tabbed in 10.12 or later
-            if ([nswindow respondsToSelector:@selector(setTabbingMode:)]) {
-                [nswindow setTabbingMode:NSWindowTabbingModeDisallowed];
-            }
-#endif
+            [nswindow setTabbingMode:NSWindowTabbingModeDisallowed];
 
             if (videodata.allow_spaces) {
                 // we put fullscreen desktop windows in their own Space, without a toggle button or menubar, later
@@ -2351,8 +2334,7 @@ bool Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Properti
         if ((window->flags & SDL_WINDOW_OPENGL) &&
             _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
             [nsview setWantsLayer:TRUE];
-            if ((window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) &&
-                [nswindow.screen respondsToSelector:@selector(backingScaleFactor)]) {
+            if ((window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY)) {
                 nsview.layer.contentsScale = nswindow.screen.backingScaleFactor;
             } else {
                 nsview.layer.contentsScale = 1;

+ 0 - 22
src/video/uikit/SDL_uikitappdelegate.m

@@ -30,14 +30,6 @@
 
 #include "../../events/SDL_events_c.h"
 
-#ifndef SDL_PLATFORM_TVOS
-#include <AvailabilityVersions.h>
-
-#ifndef __IPHONE_13_0
-#define __IPHONE_13_0 130000
-#endif
-#endif
-
 #ifdef main
 #undef main
 #endif
@@ -159,13 +151,11 @@ static UIImage *SDL_LoadLaunchImageNamed(NSString *name, int screenh)
     if ([statusBarStyle isEqualToString:@"UIStatusBarStyleLightContent"]) {
         return UIStatusBarStyleLightContent;
     }
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
     if (@available(iOS 13.0, *)) {
         if ([statusBarStyle isEqualToString:@"UIStatusBarStyleDarkContent"]) {
             return UIStatusBarStyleDarkContent;
         }
     }
-#endif
     return UIStatusBarStyleDefault;
 }
 
@@ -517,8 +507,6 @@ static UIImage *SDL_LoadLaunchImageNamed(NSString *name, int screenh)
     SDL_SendDropComplete(NULL);
 }
 
-#if defined(SDL_PLATFORM_TVOS) || (defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0)
-
 - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
 {
     // TODO: Handle options
@@ -526,16 +514,6 @@ static UIImage *SDL_LoadLaunchImageNamed(NSString *name, int screenh)
     return YES;
 }
 
-#else
-
-- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
-{
-    [self sendDropFileForURL:url fromSourceApplication:sourceApplication];
-    return YES;
-}
-
-#endif
-
 @end
 
 #endif // SDL_VIDEO_DRIVER_UIKIT

+ 0 - 39
src/video/uikit/SDL_uikitevents.m

@@ -31,14 +31,8 @@
 #include "SDL_uikitwindow.h"
 
 #import <Foundation/Foundation.h>
-
-#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 140000) || (__APPLETV_OS_VERSION_MAX_ALLOWED >= 140000) || (__MAC_OS_VERSION_MAX_ALLOWED > 1500000)
 #import <GameController/GameController.h>
 
-#define ENABLE_GCKEYBOARD
-#define ENABLE_GCMOUSE
-#endif
-
 static BOOL UIKit_EventPumpEnabled = YES;
 
 @interface SDL_LifecycleObserver : NSObject
@@ -175,8 +169,6 @@ void UIKit_PumpEvents(SDL_VideoDevice *_this)
 #endif
 }
 
-#ifdef ENABLE_GCKEYBOARD
-
 static id keyboard_connect_observer = nil;
 static id keyboard_disconnect_observer = nil;
 
@@ -257,20 +249,6 @@ void SDL_QuitGCKeyboard(void)
     }
 }
 
-#else
-
-void SDL_InitGCKeyboard(void)
-{
-}
-
-void SDL_QuitGCKeyboard(void)
-{
-}
-
-#endif // ENABLE_GCKEYBOARD
-
-#ifdef ENABLE_GCMOUSE
-
 static id mouse_connect_observer = nil;
 static id mouse_disconnect_observer = nil;
 static bool mouse_relative_mode = false;
@@ -471,21 +449,4 @@ void SDL_QuitGCMouse(void)
     }
 }
 
-#else
-
-void SDL_InitGCMouse(void)
-{
-}
-
-bool SDL_GCMouseRelativeMode(void)
-{
-    return false;
-}
-
-void SDL_QuitGCMouse(void)
-{
-}
-
-#endif // ENABLE_GCMOUSE
-
 #endif // SDL_VIDEO_DRIVER_UIKIT

+ 1 - 6
src/video/uikit/SDL_uikitmodes.m

@@ -131,12 +131,7 @@ static void UIKit_FreeDisplayModeData(SDL_DisplayMode *mode)
 #ifndef SDL_PLATFORM_VISIONOS
 static float UIKit_GetDisplayModeRefreshRate(UIScreen *uiscreen)
 {
-#ifdef __IPHONE_10_3
-    if ([uiscreen respondsToSelector:@selector(maximumFramesPerSecond)]) {
-        return (float)uiscreen.maximumFramesPerSecond;
-    }
-#endif
-    return 0.0f;
+    return (float)uiscreen.maximumFramesPerSecond;
 }
 
 static bool UIKit_AddSingleDisplayMode(SDL_VideoDisplay *display, int w, int h,

+ 1 - 1
src/video/uikit/SDL_uikitpen.h

@@ -30,7 +30,7 @@ extern void UIKit_HandlePenMotion(SDL_uikitview *view, UITouch *pencil);
 extern void UIKit_HandlePenPress(SDL_uikitview *view, UITouch *pencil);
 extern void UIKit_HandlePenRelease(SDL_uikitview *view, UITouch *pencil);
 
-#if !defined(SDL_PLATFORM_TVOS) && defined(__IPHONE_13_0)
+#if !defined(SDL_PLATFORM_TVOS)
 extern void UIKit_HandlePenHover(SDL_uikitview *view, UIHoverGestureRecognizer *recognizer) API_AVAILABLE(ios(13.0));
 #endif
 

+ 1 - 1
src/video/uikit/SDL_uikitpen.m

@@ -107,7 +107,7 @@ static void UIKit_HandlePenAxes(SDL_Window *window, NSTimeInterval nstimestamp,
     }
 }
 
-#if !defined(SDL_PLATFORM_TVOS) && defined(__IPHONE_13_0)
+#if !defined(SDL_PLATFORM_TVOS)
 extern void UIKit_HandlePenHover(SDL_uikitview *view, UIHoverGestureRecognizer *recognizer)
 {
     float zOffset = 0.0f;

+ 2 - 7
src/video/uikit/SDL_uikitvideo.m

@@ -259,13 +259,8 @@ void UIKit_ForceUpdateHomeIndicator(void)
     if (focus) {
         SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)focus->internal;
         if (data != nil) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunguarded-availability-new"
-            if ([data.viewcontroller respondsToSelector:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden)]) {
-                [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO];
-                [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO];
-            }
-#pragma clang diagnostic pop
+            [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO];
+            [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO];
         }
     }
 #endif // !SDL_PLATFORM_TVOS

+ 1 - 5
src/video/uikit/SDL_uikitview.h

@@ -23,7 +23,7 @@
 
 #include "../SDL_sysvideo.h"
 
-#if !defined(SDL_PLATFORM_TVOS) && defined(__IPHONE_13_4)
+#if !defined(SDL_PLATFORM_TVOS)
 @interface SDL_uikitview : UIView <UIPointerInteractionDelegate>
 #else
 @interface SDL_uikitview : UIView
@@ -35,16 +35,12 @@
 - (SDL_Window *)getSDLWindow;
 
 #if !defined(SDL_PLATFORM_TVOS)
-#if defined(__IPHONE_13_0)
 - (void)pencilHovering:(UIHoverGestureRecognizer *)recognizer API_AVAILABLE(ios(13.0));
-#endif
 
-#if defined(__IPHONE_13_4)
 - (UIPointerRegion *)pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion API_AVAILABLE(ios(13.4));
 - (UIPointerStyle *)pointerInteraction:(UIPointerInteraction *)interaction styleForRegion:(UIPointerRegion *)region API_AVAILABLE(ios(13.4));
 - (void)indirectPointerHovering:(UIHoverGestureRecognizer *)recognizer API_AVAILABLE(ios(13.4));
 #endif
-#endif
 
 - (CGPoint)touchLocation:(UITouch *)touch shouldNormalize:(BOOL)normalize;
 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;

+ 11 - 57
src/video/uikit/SDL_uikitview.m

@@ -49,7 +49,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
     SDL_TouchID directTouchId;
     SDL_TouchID indirectTouchId;
 
-#if !defined(SDL_PLATFORM_TVOS) && defined(__IPHONE_13_4)
+#if !defined(SDL_PLATFORM_TVOS)
     UIPointerInteraction *indirectPointerInteraction API_AVAILABLE(ios(13.4));
 #endif
 }
@@ -86,15 +86,12 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
         self.multipleTouchEnabled = YES;
         SDL_AddTouch(directTouchId, SDL_TOUCH_DEVICE_DIRECT, "");
 
-#if defined(__IPHONE_13_0)
         if (@available(iOS 13.0, *)) {
             UIHoverGestureRecognizer *pencilRecognizer = [[UIHoverGestureRecognizer alloc] initWithTarget:self action:@selector(pencilHovering:)];
             pencilRecognizer.allowedTouchTypes = @[@(UITouchTypePencil)];
             [self addGestureRecognizer:pencilRecognizer];
         }
-#endif
 
-#if defined(__IPHONE_13_4)
         if (@available(iOS 13.4, *)) {
             indirectPointerInteraction = [[UIPointerInteraction alloc] initWithDelegate:self];
             [self addInteraction:indirectPointerInteraction];
@@ -103,7 +100,6 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
             indirectPointerRecognizer.allowedTouchTypes = @[@(UITouchTypeIndirectPointer)];
             [self addGestureRecognizer:indirectPointerRecognizer];
         }
-#endif
 #endif // !defined(SDL_PLATFORM_TVOS)
     }
 
@@ -173,7 +169,6 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
 
 #if !defined(SDL_PLATFORM_TVOS)
 
-#if defined(__IPHONE_13_4)
 - (UIPointerRegion *)pointerInteraction:(UIPointerInteraction *)interaction regionForRequest:(UIPointerRegionRequest *)request defaultRegion:(UIPointerRegion *)defaultRegion API_AVAILABLE(ios(13.4))
 {
     return [UIPointerRegion regionWithRect:self.bounds identifier:nil];
@@ -253,10 +248,6 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
     }
 }
 
-#endif // __IPHONE_13_4
-
-#if defined(__IPHONE_13_0)
-
 - (void)pencilHovering:(UIHoverGestureRecognizer *)recognizer API_AVAILABLE(ios(13.0))
 {
     switch (recognizer.state) {
@@ -290,19 +281,13 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
     UIKit_HandlePenRelease(self, touch);
 }
 
-#endif // defined(__IPHONE_13_0)
 #endif // !defined(SDL_PLATFORM_TVOS)
 
 - (SDL_TouchDeviceType)touchTypeForTouch:(UITouch *)touch
 {
-#ifdef __IPHONE_9_0
-    if ([touch respondsToSelector:@selector((type))]) {
-        if (touch.type == UITouchTypeIndirect) {
-            return SDL_TOUCH_DEVICE_INDIRECT_RELATIVE;
-        }
+    if (touch.type == UITouchTypeIndirect) {
+        return SDL_TOUCH_DEVICE_INDIRECT_RELATIVE;
     }
-#endif
-
     return SDL_TOUCH_DEVICE_DIRECT;
 }
 
@@ -332,36 +317,26 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
 
 - (float)pressureForTouch:(UITouch *)touch
 {
-#ifdef __IPHONE_9_0
-    if ([touch respondsToSelector:@selector(force)]) {
-        return (float)touch.force;
-    }
-#endif
-
-    return 1.0f;
+    return (float)touch.force;
 }
 
 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
 {
     for (UITouch *touch in touches) {
 #if !defined(SDL_PLATFORM_TVOS)
-#if defined(__IPHONE_13_0)
         if (@available(iOS 13.0, *)) {
             if (touch.type == UITouchTypePencil) {
                 [self pencilPressed:touch];
                 continue;
             }
         }
-#endif
 
-#if defined(__IPHONE_13_4)
         if (@available(iOS 13.4, *)) {
             if (touch.type == UITouchTypeIndirectPointer) {
                 [self indirectPointerPressed:touch fromEvent:event];
                 continue;
             }
         }
-#endif
 #endif // !defined(SDL_PLATFORM_TVOS)
 
         SDL_TouchDeviceType touchType = [self touchTypeForTouch:touch];
@@ -385,23 +360,19 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
 {
     for (UITouch *touch in touches) {
 #if !defined(SDL_PLATFORM_TVOS)
-#if defined(__IPHONE_13_0)
         if (@available(iOS 13.0, *)) {
             if (touch.type == UITouchTypePencil) {
                 [self pencilReleased:touch];
                 continue;
             }
         }
-#endif
 
-#if defined(__IPHONE_13_4)
         if (@available(iOS 13.4, *)) {
             if (touch.type == UITouchTypeIndirectPointer) {
                 [self indirectPointerReleased:touch fromEvent:event];
                 continue;
             }
         }
-#endif
 #endif // !defined(SDL_PLATFORM_TVOS)
 
         SDL_TouchDeviceType touchType = [self touchTypeForTouch:touch];
@@ -425,23 +396,19 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
 {
     for (UITouch *touch in touches) {
 #if !defined(SDL_PLATFORM_TVOS)
-#if defined(__IPHONE_13_0)
         if (@available(iOS 13.0, *)) {
             if (touch.type == UITouchTypePencil) {
                 [self pencilReleased:touch];
                 continue;
             }
         }
-#endif
 
-#if defined(__IPHONE_13_4)
         if (@available(iOS 13.4, *)) {
             if (touch.type == UITouchTypeIndirectPointer) {
                 [self indirectPointerReleased:touch fromEvent:event];
                 continue;
             }
         }
-#endif
 #endif // !defined(SDL_PLATFORM_TVOS)
 
         SDL_TouchDeviceType touchType = [self touchTypeForTouch:touch];
@@ -463,23 +430,19 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
 {
     for (UITouch *touch in touches) {
 #if !defined(SDL_PLATFORM_TVOS)
-#if defined(__IPHONE_13_0)
         if (@available(iOS 13.0, *)) {
             if (touch.type == UITouchTypePencil) {
                 [self pencilMoving:touch];
                 continue;
             }
         }
-#endif
 
-#if defined(__IPHONE_13_4)
         if (@available(iOS 13.4, *)) {
             if (touch.type == UITouchTypeIndirectPointer) {
                 [self indirectPointerMoving:touch];
                 continue;
             }
         }
-#endif
 #endif  // !defined(SDL_PLATFORM_TVOS)
 
         SDL_TouchDeviceType touchType = [self touchTypeForTouch:touch];
@@ -500,25 +463,18 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
 - (void)safeAreaInsetsDidChange
 {
     // Update the safe area insets
-    if (@available(iOS 11.0, tvOS 11.0, *)) {
-        SDL_SetWindowSafeAreaInsets(sdlwindow,
-                                    (int)SDL_ceilf(self.safeAreaInsets.left),
-                                    (int)SDL_ceilf(self.safeAreaInsets.right),
-                                    (int)SDL_ceilf(self.safeAreaInsets.top),
-                                    (int)SDL_ceilf(self.safeAreaInsets.bottom));
-    }
+    SDL_SetWindowSafeAreaInsets(sdlwindow,
+                                (int)SDL_ceilf(self.safeAreaInsets.left),
+                                (int)SDL_ceilf(self.safeAreaInsets.right),
+                                (int)SDL_ceilf(self.safeAreaInsets.top),
+                                (int)SDL_ceilf(self.safeAreaInsets.bottom));
 }
 
-#if defined(SDL_PLATFORM_TVOS) || defined(__IPHONE_9_1)
 - (SDL_Scancode)scancodeFromPress:(UIPress *)press
 {
-#ifdef __IPHONE_13_4
-    if ([press respondsToSelector:@selector((key))]) {
-        if (press.key != nil) {
-            return (SDL_Scancode)press.key.keyCode;
-        }
+    if (press.key != nil) {
+        return (SDL_Scancode)press.key.keyCode;
     }
-#endif
 
 #ifndef SDL_JOYSTICK_DISABLED
     // Presses from Apple TV remote
@@ -597,8 +553,6 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
     }
 }
 
-#endif // defined(SDL_PLATFORM_TVOS) || defined(__IPHONE_9_1)
-
 #ifdef SDL_PLATFORM_TVOS
 - (void)swipeGesture:(UISwipeGestureRecognizer *)gesture
 {

+ 7 - 31
src/video/uikit/SDL_uikitviewcontroller.m

@@ -49,13 +49,8 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
     @autoreleasepool {
         SDL_uikitviewcontroller *viewcontroller = (__bridge SDL_uikitviewcontroller *)userdata;
         viewcontroller.homeIndicatorHidden = (hint && *hint) ? SDL_atoi(hint) : -1;
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunguarded-availability-new"
-        if ([viewcontroller respondsToSelector:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden)]) {
-            [viewcontroller setNeedsUpdateOfHomeIndicatorAutoHidden];
-            [viewcontroller setNeedsUpdateOfScreenEdgesDeferringSystemGestures];
-        }
-#pragma clang diagnostic pop
+        [viewcontroller setNeedsUpdateOfHomeIndicatorAutoHidden];
+        [viewcontroller setNeedsUpdateOfScreenEdgesDeferringSystemGestures];
     }
 }
 #endif
@@ -176,18 +171,11 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
 
 #ifdef SDL_PLATFORM_VISIONOS
     displayLink.preferredFramesPerSecond = 90 / animationInterval;      //TODO: Get frame max frame rate on visionOS
-#elif defined(__IPHONE_10_3)
+#else
     SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
 
-    if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)] && data != nil && data.uiwindow != nil && [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) {
-        displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval;
-    } else
+    displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval;
 #endif
-    {
-#if __IPHONE_OS_VERSION_MIN_REQUIRED < 100300
-        [displayLink setFrameInterval:animationInterval];
-#endif
-    }
 
     [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
 }
@@ -411,28 +399,16 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
         break;
     case SDL_TEXTINPUT_TYPE_TEXT_USERNAME:
         textField.keyboardType = UIKeyboardTypeDefault;
-        if (@available(iOS 11.0, tvOS 11.0, *)) {
-            textField.textContentType = UITextContentTypeUsername;
-        } else {
-            textField.textContentType = nil;
-        }
+        textField.textContentType = UITextContentTypeUsername;
         break;
     case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_HIDDEN:
         textField.keyboardType = UIKeyboardTypeDefault;
-        if (@available(iOS 11.0, tvOS 11.0, *)) {
-            textField.textContentType = UITextContentTypePassword;
-        } else {
-            textField.textContentType = nil;
-        }
+        textField.textContentType = UITextContentTypePassword;
         textField.secureTextEntry = YES;
         break;
     case SDL_TEXTINPUT_TYPE_TEXT_PASSWORD_VISIBLE:
         textField.keyboardType = UIKeyboardTypeDefault;
-        if (@available(iOS 11.0, tvOS 11.0, *)) {
-            textField.textContentType = UITextContentTypePassword;
-        } else {
-            textField.textContentType = nil;
-        }
+        textField.textContentType = UITextContentTypePassword;
         break;
     case SDL_TEXTINPUT_TYPE_NUMBER:
         textField.keyboardType = UIKeyboardTypeNumberPad;

+ 1 - 7
src/video/uikit/SDL_uikitwindow.m

@@ -319,7 +319,6 @@ SDL_FullscreenResult UIKit_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo
 void UIKit_UpdatePointerLock(SDL_VideoDevice *_this, SDL_Window *window)
 {
 #ifndef SDL_PLATFORM_TVOS
-#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
     @autoreleasepool {
         SDL_UIKitWindowData *data = (__bridge SDL_UIKitWindowData *)window->internal;
         SDL_uikitviewcontroller *viewcontroller = data.viewcontroller;
@@ -327,7 +326,6 @@ void UIKit_UpdatePointerLock(SDL_VideoDevice *_this, SDL_Window *window)
             [viewcontroller setNeedsUpdateOfPrefersPointerLocked];
         }
     }
-#endif // defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
 #endif // !SDL_PLATFORM_TVOS
 }
 
@@ -400,11 +398,7 @@ UIKit_GetSupportedOrientations(SDL_Window *window)
 
         /* Get all possible valid orientations. If the app delegate doesn't tell
          * us, we get the orientations from Info.plist via UIApplication. */
-        if ([app.delegate respondsToSelector:@selector(application:supportedInterfaceOrientationsForWindow:)]) {
-            validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow];
-        } else {
-            validOrientations = [app supportedInterfaceOrientationsForWindow:data.uiwindow];
-        }
+        validOrientations = [app.delegate application:app supportedInterfaceOrientationsForWindow:data.uiwindow];
 
         if (hint != NULL) {
             NSArray *orientations = [@(hint) componentsSeparatedByString:@" "];