Browse Source

mac: Rename Objective-C classes that conflict with SDL2.

Fixes #6709.
Ryan C. Gordon 9 months ago
parent
commit
06c0ed68b1

+ 25 - 25
src/joystick/apple/SDL_mfijoystick.m

@@ -1323,13 +1323,13 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
 
 #ifdef ENABLE_MFI_RUMBLE
 
-@interface SDL_RumbleMotor : NSObject
+@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));
 @property bool active;
 @end
 
-@implementation SDL_RumbleMotor
+@implementation SDL3_RumbleMotor
 {
 }
 
@@ -1420,7 +1420,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
         }
 
         self.engine.stoppedHandler = ^(CHHapticEngineStoppedReason stoppedReason) {
-          SDL_RumbleMotor *_this = weakSelf;
+          SDL3_RumbleMotor *_this = weakSelf;
           if (_this == nil) {
               return;
           }
@@ -1429,7 +1429,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
           _this.engine = nil;
         };
         self.engine.resetHandler = ^{
-          SDL_RumbleMotor *_this = weakSelf;
+          SDL3_RumbleMotor *_this = weakSelf;
           if (_this == nil) {
               return;
           }
@@ -1444,21 +1444,21 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
 
 @end
 
-@interface SDL_RumbleContext : NSObject
-@property(nonatomic, strong) SDL_RumbleMotor *lowFrequencyMotor;
-@property(nonatomic, strong) SDL_RumbleMotor *highFrequencyMotor;
-@property(nonatomic, strong) SDL_RumbleMotor *leftTriggerMotor;
-@property(nonatomic, strong) SDL_RumbleMotor *rightTriggerMotor;
+@interface SDL3_RumbleContext : NSObject
+@property(nonatomic, strong) SDL3_RumbleMotor *lowFrequencyMotor;
+@property(nonatomic, strong) SDL3_RumbleMotor *highFrequencyMotor;
+@property(nonatomic, strong) SDL3_RumbleMotor *leftTriggerMotor;
+@property(nonatomic, strong) SDL3_RumbleMotor *rightTriggerMotor;
 @end
 
-@implementation SDL_RumbleContext
+@implementation SDL3_RumbleContext
 {
 }
 
-- (id)initWithLowFrequencyMotor:(SDL_RumbleMotor *)low_frequency_motor
-             HighFrequencyMotor:(SDL_RumbleMotor *)high_frequency_motor
-               LeftTriggerMotor:(SDL_RumbleMotor *)left_trigger_motor
-              RightTriggerMotor:(SDL_RumbleMotor *)right_trigger_motor
+- (id)initWithLowFrequencyMotor:(SDL3_RumbleMotor *)low_frequency_motor
+             HighFrequencyMotor:(SDL3_RumbleMotor *)high_frequency_motor
+               LeftTriggerMotor:(SDL3_RumbleMotor *)left_trigger_motor
+              RightTriggerMotor:(SDL3_RumbleMotor *)right_trigger_motor
 {
     self = [super init];
     self.lowFrequencyMotor = low_frequency_motor;
@@ -1498,16 +1498,16 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick)
 
 @end
 
-static SDL_RumbleContext *IOS_JoystickInitRumble(GCController *controller)
+static SDL3_RumbleContext *IOS_JoystickInitRumble(GCController *controller)
 {
     @autoreleasepool {
         if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
-            SDL_RumbleMotor *low_frequency_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityLeftHandle];
-            SDL_RumbleMotor *high_frequency_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityRightHandle];
-            SDL_RumbleMotor *left_trigger_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityLeftTrigger];
-            SDL_RumbleMotor *right_trigger_motor = [[SDL_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityRightTrigger];
+            SDL3_RumbleMotor *low_frequency_motor = [[SDL3_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityLeftHandle];
+            SDL3_RumbleMotor *high_frequency_motor = [[SDL3_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityRightHandle];
+            SDL3_RumbleMotor *left_trigger_motor = [[SDL3_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityLeftTrigger];
+            SDL3_RumbleMotor *right_trigger_motor = [[SDL3_RumbleMotor alloc] initWithController:controller locality:GCHapticsLocalityRightTrigger];
             if (low_frequency_motor && high_frequency_motor) {
-                return [[SDL_RumbleContext alloc] initWithLowFrequencyMotor:low_frequency_motor
+                return [[SDL3_RumbleContext alloc] initWithLowFrequencyMotor:low_frequency_motor
                                                          HighFrequencyMotor:high_frequency_motor
                                                            LeftTriggerMotor:left_trigger_motor
                                                           RightTriggerMotor:right_trigger_motor];
@@ -1530,7 +1530,7 @@ static int IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumbl
 
     if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
         if (!device->rumble && device->controller && device->controller.haptics) {
-            SDL_RumbleContext *rumble = IOS_JoystickInitRumble(device->controller);
+            SDL3_RumbleContext *rumble = IOS_JoystickInitRumble(device->controller);
             if (rumble) {
                 device->rumble = (void *)CFBridgingRetain(rumble);
             }
@@ -1538,7 +1538,7 @@ static int IOS_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumbl
     }
 
     if (device->rumble) {
-        SDL_RumbleContext *rumble = (__bridge SDL_RumbleContext *)device->rumble;
+        SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble;
         return [rumble rumbleWithLowFrequency:low_frequency_rumble andHighFrequency:high_frequency_rumble];
     } else {
         return SDL_Unsupported();
@@ -1559,7 +1559,7 @@ static int IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble
 
     if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) {
         if (!device->rumble && device->controller && device->controller.haptics) {
-            SDL_RumbleContext *rumble = IOS_JoystickInitRumble(device->controller);
+            SDL3_RumbleContext *rumble = IOS_JoystickInitRumble(device->controller);
             if (rumble) {
                 device->rumble = (void *)CFBridgingRetain(rumble);
             }
@@ -1567,7 +1567,7 @@ static int IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble
     }
 
     if (device->rumble) {
-        SDL_RumbleContext *rumble = (__bridge SDL_RumbleContext *)device->rumble;
+        SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble;
         return [rumble rumbleLeftTrigger:left_rumble andRightTrigger:right_rumble];
     } else {
         return SDL_Unsupported();
@@ -1658,7 +1658,7 @@ static void IOS_JoystickClose(SDL_Joystick *joystick)
     @autoreleasepool {
 #ifdef ENABLE_MFI_RUMBLE
         if (device->rumble) {
-            SDL_RumbleContext *rumble = (__bridge SDL_RumbleContext *)device->rumble;
+            SDL3_RumbleContext *rumble = (__bridge SDL3_RumbleContext *)device->rumble;
 
             [rumble cleanup];
             CFRelease(device->rumble);

+ 39 - 39
src/render/metal/SDL_render_metal.m

@@ -133,7 +133,7 @@ typedef struct METAL_ShaderPipelines
     METAL_PipelineCache caches[SDL_METAL_FRAGMENT_COUNT];
 } METAL_ShaderPipelines;
 
-@interface METAL_RenderData : NSObject
+@interface SDL3METAL_RenderData : NSObject
 @property(nonatomic, retain) id<MTLDevice> mtldevice;
 @property(nonatomic, retain) id<MTLCommandQueue> mtlcmdqueue;
 @property(nonatomic, retain) id<MTLCommandBuffer> mtlcmdbuffer;
@@ -151,10 +151,10 @@ typedef struct METAL_ShaderPipelines
 @property(nonatomic, assign) int pipelinescount;
 @end
 
-@implementation METAL_RenderData
+@implementation SDL3METAL_RenderData
 @end
 
-@interface METAL_TextureData : NSObject
+@interface SDL3METAL_TextureData : NSObject
 @property(nonatomic, retain) id<MTLTexture> mtltexture;
 @property(nonatomic, retain) id<MTLTexture> mtltextureUv;
 @property(nonatomic, assign) SDL_MetalFragmentFunction fragmentFunction;
@@ -168,7 +168,7 @@ typedef struct METAL_ShaderPipelines
 @property(nonatomic, assign) SDL_Rect lockedrect;
 @end
 
-@implementation METAL_TextureData
+@implementation SDL3METAL_TextureData
 @end
 
 static SDL_bool IsMetalAvailable()
@@ -260,7 +260,7 @@ static NSString *GetFragmentFunctionName(SDL_MetalFragmentFunction function)
     }
 }
 
-static id<MTLRenderPipelineState> MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache,
+static id<MTLRenderPipelineState> MakePipelineState(SDL3METAL_RenderData *data, METAL_PipelineCache *cache,
                                                     NSString *blendlabel, SDL_BlendMode blendmode)
 {
     MTLRenderPipelineDescriptor *mtlpipedesc;
@@ -353,7 +353,7 @@ static id<MTLRenderPipelineState> MakePipelineState(METAL_RenderData *data, META
     }
 }
 
-static void MakePipelineCache(METAL_RenderData *data, METAL_PipelineCache *cache, const char *label,
+static void MakePipelineCache(SDL3METAL_RenderData *data, METAL_PipelineCache *cache, const char *label,
                               MTLPixelFormat rtformat, SDL_MetalVertexFunction vertfn, SDL_MetalFragmentFunction fragfn)
 {
     SDL_zerop(cache);
@@ -383,7 +383,7 @@ static void DestroyPipelineCache(METAL_PipelineCache *cache)
     }
 }
 
-void MakeShaderPipelines(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, MTLPixelFormat rtformat)
+void MakeShaderPipelines(SDL3METAL_RenderData *data, METAL_ShaderPipelines *pipelines, MTLPixelFormat rtformat)
 {
     SDL_zerop(pipelines);
 
@@ -395,7 +395,7 @@ void MakeShaderPipelines(METAL_RenderData *data, METAL_ShaderPipelines *pipeline
     MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_ADVANCED], "SDL advanced pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_ADVANCED);
 }
 
-static METAL_ShaderPipelines *ChooseShaderPipelines(METAL_RenderData *data, MTLPixelFormat rtformat)
+static METAL_ShaderPipelines *ChooseShaderPipelines(SDL3METAL_RenderData *data, MTLPixelFormat rtformat)
 {
     METAL_ShaderPipelines *allpipelines = data.allpipelines;
     int count = data.pipelinescount;
@@ -433,7 +433,7 @@ static void DestroyAllPipelines(METAL_ShaderPipelines *allpipelines, int count)
     }
 }
 
-static inline id<MTLRenderPipelineState> ChoosePipelineState(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, SDL_MetalFragmentFunction fragfn, SDL_BlendMode blendmode)
+static inline id<MTLRenderPipelineState> ChoosePipelineState(SDL3METAL_RenderData *data, METAL_ShaderPipelines *pipelines, SDL_MetalFragmentFunction fragfn, SDL_BlendMode blendmode)
 {
     METAL_PipelineCache *cache = &pipelines->caches[fragfn];
 
@@ -448,7 +448,7 @@ static inline id<MTLRenderPipelineState> ChoosePipelineState(METAL_RenderData *d
 
 static SDL_bool METAL_ActivateRenderCommandEncoder(SDL_Renderer *renderer, MTLLoadAction load, MTLClearColor *clear_color, id<MTLBuffer> vertex_buffer)
 {
-    METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+    SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
 
     /* Our SetRenderTarget just signals that the next render operation should
      * set up a new render pass. This is where that work happens. */
@@ -456,7 +456,7 @@ static SDL_bool METAL_ActivateRenderCommandEncoder(SDL_Renderer *renderer, MTLLo
         id<MTLTexture> mtltexture = nil;
 
         if (renderer->target != NULL) {
-            METAL_TextureData *texdata = (__bridge METAL_TextureData *)renderer->target->internal;
+            SDL3METAL_TextureData *texdata = (__bridge SDL3METAL_TextureData *)renderer->target->internal;
             mtltexture = texdata.mtltexture;
         } else {
             if (data.mtlbackbuffer == nil) {
@@ -520,7 +520,7 @@ static void METAL_WindowEvent(SDL_Renderer *renderer, const SDL_WindowEvent *eve
 static int METAL_GetOutputSize(SDL_Renderer *renderer, int *w, int *h)
 {
     @autoreleasepool {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
         if (w) {
             *w = (int)data.mtllayer.drawableSize.width;
         }
@@ -632,11 +632,11 @@ size_t GetYCbCRtoRGBConversionMatrix(SDL_Colorspace colorspace, int w, int h, in
 static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_PropertiesID create_props)
 {
     @autoreleasepool {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
         MTLPixelFormat pixfmt;
         MTLTextureDescriptor *mtltexdesc;
         id<MTLTexture> mtltexture = nil, mtltextureUv = nil;
-        METAL_TextureData *texturedata;
+        SDL3METAL_TextureData *texturedata;
         CVPixelBufferRef pixelbuffer = nil;
         IOSurfaceRef surface = nil;
 
@@ -746,7 +746,7 @@ static int METAL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL
             }
         }
 #endif /* SDL_HAVE_YUV */
-        texturedata = [[METAL_TextureData alloc] init];
+        texturedata = [[SDL3METAL_TextureData alloc] init];
         if (SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_SRGB) {
             texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY;
 #if SDL_HAVE_YUV
@@ -795,11 +795,11 @@ static MTLStorageMode METAL_GetStorageMode(id<MTLResource> resource)
     return MTLStorageModeShared;
 }
 
-static int METAL_UpdateTextureInternal(SDL_Renderer *renderer, METAL_TextureData *texturedata,
+static int METAL_UpdateTextureInternal(SDL_Renderer *renderer, SDL3METAL_TextureData *texturedata,
                                        id<MTLTexture> texture, SDL_Rect rect, int slice,
                                        const void *pixels, int pitch)
 {
-    METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+    SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
     SDL_Rect stagingrect = { 0, 0, rect.w, rect.h };
     MTLTextureDescriptor *desc;
     id<MTLTexture> stagingtex;
@@ -867,7 +867,7 @@ static int METAL_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
                                const SDL_Rect *rect, const void *pixels, int pitch)
 {
     @autoreleasepool {
-        METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
+        SDL3METAL_TextureData *texturedata = (__bridge SDL3METAL_TextureData *)texture->internal;
 
         if (METAL_UpdateTextureInternal(renderer, texturedata, texturedata.mtltexture, *rect, 0, pixels, pitch) < 0) {
             return -1;
@@ -917,7 +917,7 @@ static int METAL_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture,
                                   const Uint8 *Vplane, int Vpitch)
 {
     @autoreleasepool {
-        METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
+        SDL3METAL_TextureData *texturedata = (__bridge SDL3METAL_TextureData *)texture->internal;
         const int Uslice = 0;
         const int Vslice = 1;
         SDL_Rect UVrect = { rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2 };
@@ -949,7 +949,7 @@ static int METAL_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture,
                                  const Uint8 *UVplane, int UVpitch)
 {
     @autoreleasepool {
-        METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
+        SDL3METAL_TextureData *texturedata = (__bridge SDL3METAL_TextureData *)texture->internal;
         SDL_Rect UVrect = { rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2 };
 
         /* Bail out if we're supposed to update an empty rectangle */
@@ -976,8 +976,8 @@ static int METAL_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
                              const SDL_Rect *rect, void **pixels, int *pitch)
 {
     @autoreleasepool {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
-        METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
+        SDL3METAL_TextureData *texturedata = (__bridge SDL3METAL_TextureData *)texture->internal;
         int buffersize = 0;
         id<MTLBuffer> lockedbuffer = nil;
 
@@ -1011,8 +1011,8 @@ static int METAL_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
 static void METAL_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture)
 {
     @autoreleasepool {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
-        METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
+        SDL3METAL_TextureData *texturedata = (__bridge SDL3METAL_TextureData *)texture->internal;
         id<MTLBlitCommandEncoder> blitcmd;
         SDL_Rect rect = texturedata.lockedrect;
         int pitch = SDL_BYTESPERPIXEL(texture->format) * rect.w;
@@ -1102,7 +1102,7 @@ static void METAL_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu
 static int METAL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
 {
     @autoreleasepool {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
 
         if (data.mtlcmdencoder) {
             /* End encoding for the previous render target so we can set up a new
@@ -1392,7 +1392,7 @@ static void SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderCommand
 
 static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const SDL_MetalFragmentFunction shader, PixelShaderConstants *shader_constants, const size_t constants_offset, id<MTLBuffer> mtlbufvertex, METAL_DrawStateCache *statecache)
 {
-    METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+    SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
     const SDL_BlendMode blend = cmd->data.draw.blend;
     size_t first = cmd->data.draw.first;
     id<MTLRenderPipelineState> newpipeline;
@@ -1484,9 +1484,9 @@ static SDL_bool SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cm
 static SDL_bool SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const size_t constants_offset,
                              id<MTLBuffer> mtlbufvertex, METAL_DrawStateCache *statecache)
 {
-    METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+    SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
     SDL_Texture *texture = cmd->data.draw.texture;
-    METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->internal;
+    SDL3METAL_TextureData *texturedata = (__bridge SDL3METAL_TextureData *)texture->internal;
     PixelShaderConstants constants;
 
     SetupShaderConstants(renderer, cmd, texture, &constants);
@@ -1543,7 +1543,7 @@ static void METAL_InvalidateCachedState(SDL_Renderer *renderer)
 static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
 {
     @autoreleasepool {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
         id<MTLBuffer> mtlbufvertex = nil;
         METAL_DrawStateCache statecache;
         SDL_zero(statecache);
@@ -1692,7 +1692,7 @@ static int METAL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
 static SDL_Surface *METAL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
 {
     @autoreleasepool {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
         id<MTLTexture> mtltexture;
         MTLRegion mtlregion;
         Uint32 format;
@@ -1757,7 +1757,7 @@ static SDL_Surface *METAL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rec
 static int METAL_RenderPresent(SDL_Renderer *renderer)
 {
     @autoreleasepool {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
         SDL_bool ready = SDL_TRUE;
 
         // If we don't have a command buffer, we can't present, so activate to get one.
@@ -1806,7 +1806,7 @@ static void METAL_DestroyRenderer(SDL_Renderer *renderer)
 {
     @autoreleasepool {
         if (renderer->internal) {
-            METAL_RenderData *data = CFBridgingRelease(renderer->internal);
+            SDL3METAL_RenderData *data = CFBridgingRelease(renderer->internal);
 
             if (data.mtlcmdencoder != nil) {
                 [data.mtlcmdencoder endEncoding];
@@ -1826,7 +1826,7 @@ static void METAL_DestroyRenderer(SDL_Renderer *renderer)
 static void *METAL_GetMetalLayer(SDL_Renderer *renderer)
 {
     @autoreleasepool {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
         return (__bridge void *)data.mtllayer;
     }
 }
@@ -1837,9 +1837,9 @@ static void *METAL_GetMetalCommandEncoder(SDL_Renderer *renderer)
         // note that data.mtlcmdencoder can be nil if METAL_ActivateRenderCommandEncoder fails.
         //  Before SDL 2.0.18, it might have returned a non-nil encoding that might not have been
         //  usable for presentation. Check your return values!
-        METAL_RenderData *data;
+        SDL3METAL_RenderData *data;
         METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad, NULL, nil);
-        data = (__bridge METAL_RenderData *)renderer->internal;
+        data = (__bridge SDL3METAL_RenderData *)renderer->internal;
         return (__bridge void *)data.mtlcmdencoder;
     }
 }
@@ -1848,7 +1848,7 @@ static int 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, *)) {
-        METAL_RenderData *data = (__bridge METAL_RenderData *)renderer->internal;
+        SDL3METAL_RenderData *data = (__bridge SDL3METAL_RenderData *)renderer->internal;
         switch (vsync) {
         case 0:
             data.mtllayer.displaySyncEnabled = NO;
@@ -1903,7 +1903,7 @@ static SDL_MetalView GetWindowView(SDL_Window *window)
 static int METAL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_PropertiesID create_props)
 {
     @autoreleasepool {
-        METAL_RenderData *data = NULL;
+        SDL3METAL_RenderData *data = NULL;
         id<MTLDevice> mtldevice = nil;
         SDL_MetalView view = NULL;
         CAMetalLayer *layer = nil;
@@ -2012,7 +2012,7 @@ static int METAL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_
         }
 
         // !!! FIXME: error checking on all of this.
-        data = [[METAL_RenderData alloc] init];
+        data = [[SDL3METAL_RenderData alloc] init];
 
         if (data == nil) {
             /* Release the metal view instead of destroying it,
@@ -2020,7 +2020,7 @@ static int METAL_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_
              */
             /* SDL_Metal_DestroyView(view); */
             CFBridgingRelease(view);
-            return SDL_SetError("METAL_RenderData alloc/init failed");
+            return SDL_SetError("SDL3METAL_RenderData alloc/init failed");
         }
 
         renderer->internal = (void *)CFBridgingRetain(data);

+ 11 - 11
src/video/cocoa/SDL_cocoaevents.m

@@ -45,7 +45,7 @@ static SDL_Window *FindSDLWindowForNSWindow(NSWindow *win)
     return sdlwindow;
 }
 
-@interface SDLApplication : NSApplication
+@interface SDL3Application : NSApplication
 
 - (void)terminate:(id)sender;
 - (void)sendEvent:(NSEvent *)theEvent;
@@ -54,7 +54,7 @@ static SDL_Window *FindSDLWindowForNSWindow(NSWindow *win)
 
 @end
 
-@implementation SDLApplication
+@implementation SDL3Application
 
 // Override terminate to handle Quit and System Shutdown smoothly.
 - (void)terminate:(id)sender
@@ -114,14 +114,14 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
     [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
 }
 
-@end // SDLApplication
+@end // SDL3Application
 
 /* setAppleMenu disappeared from the headers in 10.4 */
 @interface NSApplication (NSAppleMenu)
 - (void)setAppleMenu:(NSMenu *)menu;
 @end
 
-@interface SDLAppDelegate : NSObject <NSApplicationDelegate>
+@interface SDL3AppDelegate : NSObject <NSApplicationDelegate>
 {
   @public
     BOOL seenFirstActivate;
@@ -136,7 +136,7 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
 - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app;
 @end
 
-@implementation SDLAppDelegate : NSObject
+@implementation SDL3AppDelegate : NSObject
 - (id)init
 {
     self = [super init];
@@ -330,7 +330,7 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
 
     /* If we call this before NSApp activation, macOS might print a complaint
      * about ApplePersistenceIgnoreState. */
-    [SDLApplication registerUserDefaults];
+    [SDL3Application registerUserDefaults];
 }
 
 - (void)handleURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
@@ -358,7 +358,7 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent)
 
 @end
 
-static SDLAppDelegate *appDelegate = nil;
+static SDL3AppDelegate *appDelegate = nil;
 
 static NSString *GetApplicationName(void)
 {
@@ -490,7 +490,7 @@ void Cocoa_RegisterApp(void)
         /* This can get called more than once! Be careful what you initialize! */
 
         if (NSApp == nil) {
-            [SDLApplication sharedApplication];
+            [SDL3Application sharedApplication];
             SDL_assert(NSApp != nil);
 
             s_bShouldHandleEventsInSDLApplication = SDL_TRUE;
@@ -516,11 +516,11 @@ void Cocoa_RegisterApp(void)
                 /* The SDL app delegate calls this in didFinishLaunching if it's
                  * attached to the NSApp, otherwise we need to call it manually.
                  */
-                [SDLApplication registerUserDefaults];
+                [SDL3Application registerUserDefaults];
             }
         }
         if (NSApp && !appDelegate) {
-            appDelegate = [[SDLAppDelegate alloc] init];
+            appDelegate = [[SDL3AppDelegate alloc] init];
 
             /* If someone else has an app delegate, it means we can't turn a
              * termination into SDL_Quit, and we can't handle application:openFile:
@@ -581,7 +581,7 @@ int Cocoa_PumpEventsUntilDate(SDL_VideoDevice *_this, NSDate *expiration, bool a
             Cocoa_DispatchEvent(event);
         }
 
-        // Pass events down to SDLApplication to be handled in sendEvent:
+        // Pass events down to SDL3Application to be handled in sendEvent:
         [NSApp sendEvent:event];
         if (!accumulate) {
             break;

+ 3 - 3
src/video/cocoa/SDL_cocoakeyboard.m

@@ -33,7 +33,7 @@
 /*#define DEBUG_IME NSLog */
 #define DEBUG_IME(...)
 
-@interface SDLTranslatorResponder : NSView <NSTextInputClient>
+@interface SDL3TranslatorResponder : NSView <NSTextInputClient>
 {
     NSString *_markedText;
     NSRange _markedRange;
@@ -44,7 +44,7 @@
 - (void)setInputRect:(const SDL_Rect *)rect;
 @end
 
-@implementation SDLTranslatorResponder
+@implementation SDL3TranslatorResponder
 
 - (void)setInputRect:(const SDL_Rect *)rect
 {
@@ -359,7 +359,7 @@ int Cocoa_StartTextInput(SDL_VideoDevice *_this, SDL_Window *window)
          * text input, simply remove the field editor from its superview then add
          * it to the front most window's content view */
         if (!data.fieldEdit) {
-            data.fieldEdit = [[SDLTranslatorResponder alloc] initWithFrame:NSMakeRect(0.0, 0.0, 0.0, 0.0)];
+            data.fieldEdit = [[SDL3TranslatorResponder alloc] initWithFrame:NSMakeRect(0.0, 0.0, 0.0, 0.0)];
         }
 
         if (![[data.fieldEdit superview] isEqual:parentView]) {

+ 4 - 4
src/video/cocoa/SDL_cocoamessagebox.m

@@ -24,7 +24,7 @@
 
 #include "SDL_cocoavideo.h"
 
-@interface SDLMessageBoxPresenter : NSObject
+@interface SDL3MessageBoxPresenter : NSObject
 {
   @public
     NSInteger clicked;
@@ -33,7 +33,7 @@
 - (id)initWithParentWindow:(SDL_Window *)window;
 @end
 
-@implementation SDLMessageBoxPresenter
+@implementation SDL3MessageBoxPresenter
 - (id)initWithParentWindow:(SDL_Window *)window
 {
     self = [super init];
@@ -70,7 +70,7 @@ static void Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, i
 {
     NSAlert *alert;
     const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons;
-    SDLMessageBoxPresenter *presenter;
+    SDL3MessageBoxPresenter *presenter;
     NSInteger clicked;
     int i;
     Cocoa_RegisterApp();
@@ -108,7 +108,7 @@ static void Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, i
         }
     }
 
-    presenter = [[SDLMessageBoxPresenter alloc] initWithParentWindow:messageboxdata->window];
+    presenter = [[SDL3MessageBoxPresenter alloc] initWithParentWindow:messageboxdata->window];
 
     [presenter showAlert:alert];
 

+ 1 - 1
src/video/cocoa/SDL_cocoametalview.h

@@ -39,7 +39,7 @@
 #import <Metal/Metal.h>
 #import <QuartzCore/CAMetalLayer.h>
 
-@interface SDL_cocoametalview : NSView
+@interface SDL3_cocoametalview : NSView
 
 - (instancetype)initWithFrame:(NSRect)frame
                       highDPI:(BOOL)highDPI

+ 6 - 6
src/video/cocoa/SDL_cocoametalview.m

@@ -41,7 +41,7 @@ static int SDLCALL SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
      * exit-space button). */
     if (event->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) {
         @autoreleasepool {
-            SDL_cocoametalview *view = (__bridge SDL_cocoametalview *)userdata;
+            SDL3_cocoametalview *view = (__bridge SDL3_cocoametalview *)userdata;
             if (view.sdlWindowID == event->window.windowID) {
                 [view updateDrawableSize];
             }
@@ -50,7 +50,7 @@ static int SDLCALL SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
     return 0;
 }
 
-@implementation SDL_cocoametalview
+@implementation SDL3_cocoametalview
 
 /* Return a Metal-compatible layer. */
 + (Class)layerClass
@@ -138,10 +138,10 @@ SDL_MetalView Cocoa_Metal_CreateView(SDL_VideoDevice *_this, SDL_Window *window)
         BOOL highDPI = (window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) != 0;
         BOOL opaque = (window->flags & SDL_WINDOW_TRANSPARENT) == 0;
         Uint32 windowID = SDL_GetWindowID(window);
-        SDL_cocoametalview *newview;
+        SDL3_cocoametalview *newview;
         SDL_MetalView metalview;
 
-        newview = [[SDL_cocoametalview alloc] initWithFrame:view.frame
+        newview = [[SDL3_cocoametalview alloc] initWithFrame:view.frame
                                                     highDPI:highDPI
                                                    windowID:windowID
                                                      opaque:opaque];
@@ -164,7 +164,7 @@ SDL_MetalView Cocoa_Metal_CreateView(SDL_VideoDevice *_this, SDL_Window *window)
 void Cocoa_Metal_DestroyView(SDL_VideoDevice *_this, SDL_MetalView view)
 {
     @autoreleasepool {
-        SDL_cocoametalview *metalview = CFBridgingRelease(view);
+        SDL3_cocoametalview *metalview = CFBridgingRelease(view);
         [metalview removeFromSuperview];
     }
 }
@@ -172,7 +172,7 @@ void Cocoa_Metal_DestroyView(SDL_VideoDevice *_this, SDL_MetalView view)
 void *Cocoa_Metal_GetLayer(SDL_VideoDevice *_this, SDL_MetalView view)
 {
     @autoreleasepool {
-        SDL_cocoametalview *cocoaview = (__bridge SDL_cocoametalview *)view;
+        SDL3_cocoametalview *cocoaview = (__bridge SDL3_cocoametalview *)view;
         return (__bridge void *)cocoaview.layer;
     }
 }

+ 1 - 1
src/video/cocoa/SDL_cocoamouse.m

@@ -500,7 +500,7 @@ void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event)
     data->lastMoveY = location.y;
     DLog("Last seen mouse: (%g, %g)", location.x, location.y);
 
-    /* Non-relative movement is handled in -[Cocoa_WindowListener mouseMoved:] */
+    /* Non-relative movement is handled in -[SDL3Cocoa_WindowListener mouseMoved:] */
     if (!mouse->relative_mode) {
         return;
     }

+ 1 - 1
src/video/cocoa/SDL_cocoaopengl.h

@@ -39,7 +39,7 @@ struct SDL_GLDriverData
     int initialized;
 };
 
-@interface SDLOpenGLContext : NSOpenGLContext
+@interface SDL3OpenGLContext : NSOpenGLContext
 {
     SDL_AtomicInt dirty;
     SDL_Window *window;

+ 10 - 10
src/video/cocoa/SDL_cocoaopengl.m

@@ -61,7 +61,7 @@ static void SDLCALL SDL_OpenGLAsyncDispatchChanged(void *userdata, const char *n
 
 static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *now, const CVTimeStamp *outputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext)
 {
-    SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)displayLinkContext;
+    SDL3OpenGLContext *nscontext = (__bridge SDL3OpenGLContext *)displayLinkContext;
 
     /*printf("DISPLAY LINK! %u\n", (unsigned int) SDL_GetTicks()); */
     const int setting = SDL_AtomicGet(&nscontext->swapIntervalSetting);
@@ -75,7 +75,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
     return kCVReturnSuccess;
 }
 
-@implementation SDLOpenGLContext : NSOpenGLContext
+@implementation SDL3OpenGLContext : NSOpenGLContext
 
 - (id)initWithFormat:(NSOpenGLPixelFormat *)format
         shareContext:(NSOpenGLContext *)share
@@ -121,7 +121,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
 {
     const int value = SDL_AtomicSet(&self->dirty, 0);
     if (value > 0) {
-        /* We call the real underlying update here, since -[SDLOpenGLContext update] just calls us. */
+        /* We call the real underlying update here, since -[SDL3OpenGLContext update] just calls us. */
         [self explicitUpdate];
     }
 }
@@ -261,7 +261,7 @@ SDL_GLContext Cocoa_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
         SDL_DisplayData *displaydata = (SDL_DisplayData *)display->internal;
         NSOpenGLPixelFormatAttribute attr[32];
         NSOpenGLPixelFormat *fmt;
-        SDLOpenGLContext *context;
+        SDL3OpenGLContext *context;
         SDL_GLContext sdlcontext;
         NSOpenGLContext *share_context = nil;
         int i = 0;
@@ -369,7 +369,7 @@ SDL_GLContext Cocoa_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
             share_context = (__bridge NSOpenGLContext *)SDL_GL_GetCurrentContext();
         }
 
-        context = [[SDLOpenGLContext alloc] initWithFormat:fmt shareContext:share_context];
+        context = [[SDL3OpenGLContext alloc] initWithFormat:fmt shareContext:share_context];
 
         if (context == nil) {
             SDL_SetError("Failed creating OpenGL context");
@@ -439,7 +439,7 @@ int Cocoa_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLConte
 {
     @autoreleasepool {
         if (context) {
-            SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)context;
+            SDL3OpenGLContext *nscontext = (__bridge SDL3OpenGLContext *)context;
             if ([nscontext window] != window) {
                 [nscontext setWindow:window];
                 [nscontext updateIfNeeded];
@@ -456,7 +456,7 @@ int Cocoa_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLConte
 int Cocoa_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval)
 {
     @autoreleasepool {
-        SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)SDL_GL_GetCurrentContext();
+        SDL3OpenGLContext *nscontext = (__bridge SDL3OpenGLContext *)SDL_GL_GetCurrentContext();
         int status;
 
         if (nscontext == nil) {
@@ -476,7 +476,7 @@ int Cocoa_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval)
 int Cocoa_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval)
 {
     @autoreleasepool {
-        SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)SDL_GL_GetCurrentContext();
+        SDL3OpenGLContext *nscontext = (__bridge SDL3OpenGLContext *)SDL_GL_GetCurrentContext();
         if (nscontext) {
             *interval = SDL_AtomicGet(&nscontext->swapIntervalSetting);
             return 0;
@@ -489,7 +489,7 @@ int Cocoa_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval)
 int Cocoa_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
-        SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)SDL_GL_GetCurrentContext();
+        SDL3OpenGLContext *nscontext = (__bridge SDL3OpenGLContext *)SDL_GL_GetCurrentContext();
         SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->internal;
         const int setting = SDL_AtomicGet(&nscontext->swapIntervalSetting);
 
@@ -526,7 +526,7 @@ int Cocoa_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
 int Cocoa_GL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
 {
     @autoreleasepool {
-        SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)context;
+        SDL3OpenGLContext *nscontext = (__bridge SDL3OpenGLContext *)context;
         [nscontext cleanup];
         CFRelease(context);
     }

+ 2 - 2
src/video/cocoa/SDL_cocoavideo.h

@@ -94,14 +94,14 @@ DECLARE_ALERT_STYLE(Critical);
 
 /* Private display data */
 
-@class SDLTranslatorResponder;
+@class SDL3TranslatorResponder;
 
 @interface SDL_CocoaVideoData : NSObject
 @property(nonatomic) int allow_spaces;
 @property(nonatomic) int trackpad_is_touch_only;
 @property(nonatomic) unsigned int modifierFlags;
 @property(nonatomic) void *key_layout;
-@property(nonatomic) SDLTranslatorResponder *fieldEdit;
+@property(nonatomic) SDL3TranslatorResponder *fieldEdit;
 @property(nonatomic) NSInteger clipboard_count;
 @property(nonatomic) IOPMAssertionID screensaver_assertion;
 @property(nonatomic) SDL_Mutex *swaplock;

+ 3 - 3
src/video/cocoa/SDL_cocoawindow.h

@@ -41,7 +41,7 @@ typedef enum
     PENDING_OPERATION_MINIMIZE = 0x04
 } PendingWindowOperation;
 
-@interface Cocoa_WindowListener : NSResponder <NSWindowDelegate>
+@interface SDL3Cocoa_WindowListener : NSResponder <NSWindowDelegate>
 {
     /* SDL_CocoaWindowData owns this Listener and has a strong reference to it.
      * To avoid reference cycles, we could have either a weak or an
@@ -124,7 +124,7 @@ typedef enum
 @end
 /* *INDENT-ON* */
 
-@class SDLOpenGLContext;
+@class SDL3OpenGLContext;
 @class SDL_CocoaVideoData;
 
 @interface SDL_CocoaWindowData : NSObject
@@ -137,7 +137,7 @@ typedef enum
 @property(nonatomic) NSInteger window_number;
 @property(nonatomic) NSInteger flash_request;
 @property(nonatomic) SDL_Window *keyboard_focus;
-@property(nonatomic) Cocoa_WindowListener *listener;
+@property(nonatomic) SDL3Cocoa_WindowListener *listener;
 @property(nonatomic) NSModalSession modal_session;
 @property(nonatomic) SDL_CocoaVideoData *videodata;
 @property(nonatomic) SDL_bool send_floating_size;

+ 15 - 15
src/video/cocoa/SDL_cocoawindow.m

@@ -73,7 +73,7 @@
 @property(nonatomic) NSRect mouseConfinementRect;
 @end
 
-@interface SDLWindow : NSWindow <NSDraggingDestination>
+@interface SDL3Window : NSWindow <NSDraggingDestination>
 /* These are needed for borderless/fullscreen windows */
 - (BOOL)canBecomeKeyWindow;
 - (BOOL)canBecomeMainWindow;
@@ -90,7 +90,7 @@
 - (SDL_Window *)findSDLWindow;
 @end
 
-@implementation SDLWindow
+@implementation SDL3Window
 
 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem
 {
@@ -140,7 +140,7 @@
     }
 
     delegate = [self delegate];
-    if (![delegate isKindOfClass:[Cocoa_WindowListener class]]) {
+    if (![delegate isKindOfClass:[SDL3Cocoa_WindowListener class]]) {
         return;
     }
 
@@ -418,7 +418,7 @@ static void ScheduleContextUpdates(SDL_CocoaWindowData *data)
     currentContext = [NSOpenGLContext currentContext];
     contexts = data.nscontexts;
     @synchronized(contexts) {
-        for (SDLOpenGLContext *context in contexts) {
+        for (SDL3OpenGLContext *context in contexts) {
             if (context == currentContext) {
                 [context update];
             } else {
@@ -672,7 +672,7 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
     return [NSCursor invisibleCursor];
 }
 
-@implementation Cocoa_WindowListener
+@implementation SDL3Cocoa_WindowListener
 
 - (void)listen:(SDL_CocoaWindowData *)data
 {
@@ -994,7 +994,7 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
 
 - (void)windowWillMove:(NSNotification *)aNotification
 {
-    if ([_data.nswindow isKindOfClass:[SDLWindow class]]) {
+    if ([_data.nswindow isKindOfClass:[SDL3Window class]]) {
         pendingWindowWarpX = pendingWindowWarpY = FLT_MAX;
         isMoving = YES;
     }
@@ -1245,7 +1245,7 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
 #ifdef SDL_VIDEO_OPENGL
 
     if (_data && _data.nscontexts) {
-        for (SDLOpenGLContext *context in _data.nscontexts) {
+        for (SDL3OpenGLContext *context in _data.nscontexts) {
             [context movedToNewScreen];
         }
     }
@@ -1894,7 +1894,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
 
 @end
 
-@interface SDLView : NSView
+@interface SDL3View : NSView
 {
     SDL_Window *_sdlWindow;
 }
@@ -1910,7 +1910,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
 - (void)updateLayer;
 @end
 
-@implementation SDLView
+@implementation SDL3View
 
 - (void)setSDLWindow:(SDL_Window *)window
 {
@@ -2007,7 +2007,7 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow
         data.sdlContentView = nsview;
 
         /* Create an event listener for the window */
-        data.listener = [[Cocoa_WindowListener alloc] init];
+        data.listener = [[SDL3Cocoa_WindowListener alloc] init];
 
         /* Fill in the SDL window with the window data */
         {
@@ -2157,7 +2157,7 @@ int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
             NSScreen *screen;
             NSRect rect, screenRect;
             NSUInteger style;
-            SDLView *contentView;
+            SDL3View *contentView;
 
             SDL_RelativeToGlobalForWindow(window, window->x, window->y, &x, &y);
             rect.origin.x = x;
@@ -2187,7 +2187,7 @@ int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
             }
 
             @try {
-                nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
+                nswindow = [[SDL3Window alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO screen:screen];
             }
             @catch (NSException *e) {
                 return SDL_SetError("%s", [[e reason] UTF8String]);
@@ -2212,7 +2212,7 @@ int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propertie
 
             /* Create a default view for this window */
             rect = [nswindow contentRectForFrameRect:[nswindow frame]];
-            contentView = [[SDLView alloc] initWithFrame:rect];
+            contentView = [[SDL3View alloc] initWithFrame:rect];
             [contentView setSDLWindow:window];
             nsview = contentView;
         }
@@ -2651,7 +2651,7 @@ void Cocoa_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bo
          * -flibit
          */
         SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->internal;
-        Cocoa_WindowListener *listener = data.listener;
+        SDL3Cocoa_WindowListener *listener = data.listener;
         NSWindow *nswindow = data.nswindow;
         SDL_CocoaVideoData *videodata = data.videodata;
         if (![listener isInFullscreenSpace] && ![listener isInFullscreenSpaceTransition]) {
@@ -2951,7 +2951,7 @@ void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
 #ifdef SDL_VIDEO_OPENGL
 
             contexts = [data.nscontexts copy];
-            for (SDLOpenGLContext *context in contexts) {
+            for (SDL3OpenGLContext *context in contexts) {
                 /* Calling setWindow:NULL causes the context to remove itself from the context list. */
                 [context setWindow:NULL];
             }