aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/cocoa
diff options
context:
space:
mode:
authorGravatar Akemi <der.richter@gmx.de>2017-01-29 18:54:59 +0100
committerGravatar Akemi <der.richter@gmx.de>2017-02-02 16:25:44 +0100
commit5f10a415d7547fe6c1a25fa5594491991cef7f5d (patch)
tree0e94a06ad967beffa87f85e30d95c79748386f1c /video/out/cocoa
parent6da224b1ddc6f28fe38900b6146f739d3acfb648 (diff)
cocoa: fix dropping of files and URLs
the problem here is that dropped files can also be treated as NSURLPboardType instead of just NSFilenamesPboardType. the 'else if' could never be reached and was dead code. this basically reverts ed695ce which tried to fix multiple dropped URLs, or rather files, and moves the filename check infront of the URL check. the filename path can handle multiple dropped files, whereas the URL path can only handle one dropped URL. this assumes that only one URL can be dropped at a time. it also reverts a603543 because it's not needed any more. this also fixes a problem where dropped URLs from Chrome don't conform to the NSURL class and the readObjectsForClasses method always returned an empty URL. Fixes #4036
Diffstat (limited to 'video/out/cocoa')
-rw-r--r--video/out/cocoa/events_view.m19
1 files changed, 5 insertions, 14 deletions
diff --git a/video/out/cocoa/events_view.m b/video/out/cocoa/events_view.m
index 3bf7bd44f4..f76ca0d617 100644
--- a/video/out/cocoa/events_view.m
+++ b/video/out/cocoa/events_view.m
@@ -313,23 +313,14 @@
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
- if ([[pboard types] containsObject:NSURLPboardType]) {
- NSArray *pbitems = [pboard readObjectsForClasses:@[[NSURL class]]
- options:@{}];
- NSMutableArray* ar = [[[NSMutableArray alloc] init] autorelease];
- for (NSURL* url in pbitems) {
- if ([url isFileURL]) {
- [ar addObject:[url path]];
- } else {
- [ar addObject:[url absoluteString]];
- }
- }
- [self.adapter handleFilesArray:ar];
- return YES;
- } else if ([[pboard types] containsObject:NSFilenamesPboardType]) {
+ if ([[pboard types] containsObject:NSFilenamesPboardType]) {
NSArray *pbitems = [pboard propertyListForType:NSFilenamesPboardType];
[self.adapter handleFilesArray:pbitems];
return YES;
+ } else if ([[pboard types] containsObject:NSURLPboardType]) {
+ NSURL *url = [NSURL URLFromPasteboard:pboard];
+ [self.adapter handleFilesArray:@[[url absoluteString]]];
+ return YES;
}
return NO;
}