Avoid macOS NSFilenamesPboardType warning (bug#33035)
* src/nsterm.h (NS_USE_NSPasteboardTypeFileURL): New #define. * src/nsterm.m (ns_term_init): ([EmacsView performDragOperation:]): * src/nsselect.m (ns_string_to_symbol): (nxatoms_of_nsselect): NSFilenamesPboardType was deprecated in macOS 10.14; use NSPasteboardTypeFileURL instead when available.
This commit is contained in:
parent
3b4050154e
commit
36d33776c2
3 changed files with 40 additions and 5 deletions
|
@ -78,7 +78,13 @@ Updated by Christian Limpach (chris@nice.ch)
|
|||
return QSECONDARY;
|
||||
if ([t isEqualToString: NSPasteboardTypeString])
|
||||
return QTEXT;
|
||||
if ([t isEqualToString: NSFilenamesPboardType])
|
||||
if ([t isEqualToString:
|
||||
#if NS_USE_NSPasteboardTypeFileURL != 0
|
||||
NSPasteboardTypeFileURL
|
||||
#else
|
||||
NSFilenamesPboardType
|
||||
#endif
|
||||
])
|
||||
return QFILE_NAME;
|
||||
if ([t isEqualToString: NSPasteboardTypeTabularText])
|
||||
return QTEXT;
|
||||
|
@ -467,7 +473,12 @@ Updated by Christian Limpach (chris@nice.ch)
|
|||
[NSNumber numberWithLong:0], NXPrimaryPboard,
|
||||
[NSNumber numberWithLong:0], NXSecondaryPboard,
|
||||
[NSNumber numberWithLong:0], NSPasteboardTypeString,
|
||||
[NSNumber numberWithLong:0], NSFilenamesPboardType,
|
||||
[NSNumber numberWithLong:0],
|
||||
#if NS_USE_NSPasteboardTypeFileURL != 0
|
||||
NSPasteboardTypeFileURL,
|
||||
#else
|
||||
NSFilenamesPboardType,
|
||||
#endif
|
||||
[NSNumber numberWithLong:0], NSPasteboardTypeTabularText,
|
||||
nil] retain];
|
||||
}
|
||||
|
|
|
@ -39,6 +39,15 @@ typedef CGFloat EmacsCGFloat;
|
|||
typedef float EmacsCGFloat;
|
||||
#endif
|
||||
|
||||
/* NSFilenamesPboardType is deprecated in macOS 10.14, but
|
||||
NSPasteboardTypeFileURL is only available in 10.13 (and GNUstep
|
||||
probably lacks it too). */
|
||||
#if defined NS_IMPL_COCOA && MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
|
||||
#define NS_USE_NSPasteboardTypeFileURL 1
|
||||
#else
|
||||
#define NS_USE_NSPasteboardTypeFileURL 0
|
||||
#endif
|
||||
|
||||
/* ==========================================================================
|
||||
|
||||
Trace support
|
||||
|
|
21
src/nsterm.m
21
src/nsterm.m
|
@ -5602,7 +5602,11 @@ Needs to be here because ns_initialize_display_info () uses AppKit classes.
|
|||
ns_drag_types = [[NSArray arrayWithObjects:
|
||||
NSPasteboardTypeString,
|
||||
NSPasteboardTypeTabularText,
|
||||
#if NS_USE_NSPasteboardTypeFileURL != 0
|
||||
NSPasteboardTypeFileURL,
|
||||
#else
|
||||
NSFilenamesPboardType,
|
||||
#endif
|
||||
NSPasteboardTypeURL, nil] retain];
|
||||
|
||||
/* If fullscreen is in init/default-frame-alist, focus isn't set
|
||||
|
@ -8533,9 +8537,19 @@ -(BOOL)performDragOperation: (id <NSDraggingInfo>) sender
|
|||
{
|
||||
return NO;
|
||||
}
|
||||
/* FIXME: NSFilenamesPboardType is deprecated in 10.14, but the
|
||||
NSURL method can only handle one file at a time. Stick with the
|
||||
existing code at the moment. */
|
||||
#if NS_USE_NSPasteboardTypeFileURL != 0
|
||||
else if ([type isEqualToString: NSPasteboardTypeFileURL])
|
||||
{
|
||||
type_sym = Qfile;
|
||||
|
||||
NSArray *urls = [pb readObjectsForClasses: @[[NSURL self]]
|
||||
options: nil];
|
||||
NSEnumerator *uenum = [urls objectEnumerator];
|
||||
NSURL *url;
|
||||
while ((url = [uenum nextObject]))
|
||||
strings = Fcons ([[url path] lispString], strings);
|
||||
}
|
||||
#else // !NS_USE_NSPasteboardTypeFileURL
|
||||
else if ([type isEqualToString: NSFilenamesPboardType])
|
||||
{
|
||||
NSArray *files;
|
||||
|
@ -8551,6 +8565,7 @@ -(BOOL)performDragOperation: (id <NSDraggingInfo>) sender
|
|||
while ( (file = [fenum nextObject]) )
|
||||
strings = Fcons ([file lispString], strings);
|
||||
}
|
||||
#endif // !NS_USE_NSPasteboardTypeFileURL
|
||||
else if ([type isEqualToString: NSPasteboardTypeURL])
|
||||
{
|
||||
NSURL *url = [NSURL URLFromPasteboard: pb];
|
||||
|
|
Loading…
Add table
Reference in a new issue