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
This commit is contained in:
Sam Lantinga
2025-01-14 09:19:39 -08:00
parent 8f8af918ba
commit cdde6dd7bb
29 changed files with 264 additions and 739 deletions
+4 -4
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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>
+9 -24
View File
@@ -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.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 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
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
File diff suppressed because it is too large Load Diff
+1 -7
View File
@@ -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
View File
@@ -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;
-4
View File
@@ -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;
-4
View File
@@ -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;
-8
View File
@@ -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
}
-58
View File
@@ -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
View File
@@ -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
View File
@@ -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;
-22
View File
@@ -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
-39
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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:@" "];