summaryrefslogtreecommitdiffstats
path: root/osdep/macosx_events.m
diff options
context:
space:
mode:
authorFRAU KOUJIRO <frau@doushio.com>2014-04-15 19:38:19 -0700
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2014-08-06 09:31:58 +0200
commit0be25a8dbf5447e1fb543b3096464a24a81d863a (patch)
treeeed06938c3bdc433ea572fa53dc39db2b1182b2f /osdep/macosx_events.m
parent4fc8dcde2ae1525c8ea52d04ed0e7768decf901a (diff)
downloadmpv-0be25a8dbf5447e1fb543b3096464a24a81d863a.tar.bz2
mpv-0be25a8dbf5447e1fb543b3096464a24a81d863a.tar.xz
cocoa: move handleFilesArray: to macosx_events
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