mirror of
				https://github.com/glfw/glfw.git
				synced 2025-10-31 12:42:26 +00:00 
			
		
		
		
	Cocoa: Disable deprecated function on macOS 10.12+
CGDisplayModeCopyPixelEncoding is deprecated starting with macOS 10.12.
This commit is contained in:
		
							parent
							
								
									d19a21bd01
								
							
						
					
					
						commit
						9190cf8796
					
				| @ -118,6 +118,8 @@ information on what to include when reporting a bug. | |||||||
| - [Cocoa] Bugfix: Window creation failed to set first responder (#876,#883) | - [Cocoa] Bugfix: Window creation failed to set first responder (#876,#883) | ||||||
| - [Cocoa] Bugfix: Removed use of deprecated `CGDisplayIOServicePort` function | - [Cocoa] Bugfix: Removed use of deprecated `CGDisplayIOServicePort` function | ||||||
|                   (#165,#192,#508,#511) |                   (#165,#192,#508,#511) | ||||||
|  | - [Cocoa] Bugfix: Disabled use of deprecated `CGDisplayModeCopyPixelEncoding` | ||||||
|  |                   function on macOS 10.12+ | ||||||
| - [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871) | - [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -128,6 +128,7 @@ static GLFWbool modeIsGood(CGDisplayModeRef mode) | |||||||
|     if (flags & kDisplayModeStretchedFlag) |     if (flags & kDisplayModeStretchedFlag) | ||||||
|         return GLFW_FALSE; |         return GLFW_FALSE; | ||||||
| 
 | 
 | ||||||
|  | #if MAC_OS_X_VERSION_MAX_ALLOWED <= 101200 | ||||||
|     CFStringRef format = CGDisplayModeCopyPixelEncoding(mode); |     CFStringRef format = CGDisplayModeCopyPixelEncoding(mode); | ||||||
|     if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) && |     if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) && | ||||||
|         CFStringCompare(format, CFSTR(IO32BitDirectPixels), 0)) |         CFStringCompare(format, CFSTR(IO32BitDirectPixels), 0)) | ||||||
| @ -137,6 +138,7 @@ static GLFWbool modeIsGood(CGDisplayModeRef mode) | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     CFRelease(format); |     CFRelease(format); | ||||||
|  | #endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ | ||||||
|     return GLFW_TRUE; |     return GLFW_TRUE; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -157,8 +159,8 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode, | |||||||
|             result.refreshRate = (int) (time.timeScale / (double) time.timeValue); |             result.refreshRate = (int) (time.timeScale / (double) time.timeValue); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | #if MAC_OS_X_VERSION_MAX_ALLOWED <= 101200 | ||||||
|     CFStringRef format = CGDisplayModeCopyPixelEncoding(mode); |     CFStringRef format = CGDisplayModeCopyPixelEncoding(mode); | ||||||
| 
 |  | ||||||
|     if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0) |     if (CFStringCompare(format, CFSTR(IO16BitDirectPixels), 0) == 0) | ||||||
|     { |     { | ||||||
|         result.redBits = 5; |         result.redBits = 5; | ||||||
| @ -166,13 +168,16 @@ static GLFWvidmode vidmodeFromCGDisplayMode(CGDisplayModeRef mode, | |||||||
|         result.blueBits = 5; |         result.blueBits = 5; | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|  | #endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ | ||||||
|     { |     { | ||||||
|         result.redBits = 8; |         result.redBits = 8; | ||||||
|         result.greenBits = 8; |         result.greenBits = 8; | ||||||
|         result.blueBits = 8; |         result.blueBits = 8; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | #if MAC_OS_X_VERSION_MAX_ALLOWED <= 101200 | ||||||
|     CFRelease(format); |     CFRelease(format); | ||||||
|  | #endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ | ||||||
|     return result; |     return result; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user