SDL: cocoa: set sRGB colorspace on nswindow

From d2300516c3998277c993fd4ac336fbb4ba71641a Mon Sep 17 00:00:00 2001
From: Steven Noonan <[EMAIL REDACTED]>
Date: Wed, 7 Sep 2022 06:49:02 -0700
Subject: [PATCH] cocoa: set sRGB colorspace on nswindow

This makes the colorspace match across different graphics APIs. By
default, OpenGL was getting a much more saturated colorspace (maybe
Display P3?) and it was looking very different from the rendering done
by Metal or MoltenVK.
---
 src/video/cocoa/SDL_cocoawindow.m | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index c79cdc8451a0..ec223c6d3853 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -1743,6 +1743,8 @@ - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
         return SDL_SetError("%s", [[e reason] UTF8String]);
     }
 
+    [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:)]) {