summaryrefslogtreecommitdiffstats
path: root/osdep/macosx_events.m
diff options
context:
space:
mode:
Diffstat (limited to 'osdep/macosx_events.m')
-rw-r--r--osdep/macosx_events.m15
1 files changed, 15 insertions, 0 deletions
diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m
index 0b3eeb1d48..97ef93f405 100644
--- a/osdep/macosx_events.m
+++ b/osdep/macosx_events.m
@@ -26,6 +26,7 @@
#import <Cocoa/Cocoa.h>
#include "talloc.h"
+#include "input/event.h"
#include "input/input.h"
#include "input/keycodes.h"
// doesn't make much sense, but needed to access keymap functionality
@@ -410,4 +411,18 @@ void cocoa_set_input_context(struct input_ctx *input_context)
return nil;
}
+
+- (void)handleFilesArray:(NSArray *)files
+{
+ size_t num_files = [files count];
+ char **files_utf8 = talloc_array(NULL, char*, num_files);
+ [files enumerateObjectsUsingBlock:^(id obj, NSUInteger i, BOOL *_){
+ char *filename = (char *)[obj UTF8String];
+ size_t bytes = [obj lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+ files_utf8[i] = talloc_memdup(files_utf8, filename, bytes + 1);
+ }];
+ mp_event_drop_files(_inputContext, num_files, files_utf8);
+ talloc_free(files_utf8);
+}
+
@end