From 7f6aa587f8a0640b055133eddf09c9a652c94234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 2 Feb 2022 19:20:32 +0100 Subject: [PATCH] Cocoa: Fix deprecation warning for kUTTypeURL We switched to kUTTypeURL when NSURLPboardType was deprecated, as the official replacement symbol NSPasteboardTypeURL was not available on every version of macOS supported by GLFW. kUTTypeURL has now also been deprecated. This commit moves to a compile-time choice between NSURLPboardType and NSPasteboardTypeURL depending on the minimum targeted macOS version. Fixes #2003 --- CONTRIBUTORS.md | 1 + README.md | 1 + src/cocoa_platform.h | 4 ++++ src/cocoa_window.m | 4 +--- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 1bfc5bc5..cb9b0d58 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -183,6 +183,7 @@ video tutorials. - Ali Sherief - Yoshiki Shibukawa - Dmitri Shuralyov + - Daniel Sieger - Daniel Skorupski - Anthony Smith - Bradley Smith diff --git a/README.md b/README.md index 4a3fb85c..7ffd4850 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,7 @@ information on what to include when reporting a bug. - [Cocoa] Bugfix: Moving the cursor programmatically would freeze it for a fraction of a second (#1962) - [Cocoa] Bugfix: `kIOMasterPortDefault` was deprecated in macOS 12.0 (#1980) + - [Cocoa] Bugfix: `kUTTypeURL` was deprecated in macOS 12.0 (#2003) - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) - [X11] Bugfix: Key names were not updated when the keyboard layout changed (#1462,#1528) diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h index 67c1a3cc..9d88ac4f 100644 --- a/src/cocoa_platform.h +++ b/src/cocoa_platform.h @@ -70,6 +70,10 @@ typedef void* id; #define NSWindowStyleMaskTitled NSTitledWindowMask #endif +#if MAC_OS_X_VERSION_MIN_REQUIRED < 101300 + #define NSPasteboardTypeURL NSURLPboardType +#endif + typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; typedef VkFlags VkMetalSurfaceCreateFlagsEXT; diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 660bbd31..e461b267 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -361,9 +361,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; markedText = [[NSMutableAttributedString alloc] init]; [self updateTrackingAreas]; - // NOTE: kUTTypeURL corresponds to NSPasteboardTypeURL but is available - // on 10.7 without having been deprecated yet - [self registerForDraggedTypes:@[(__bridge NSString*) kUTTypeURL]]; + [self registerForDraggedTypes:@[NSPasteboardTypeURL]]; } return self;