From 3bb06155c9c02fb662aa012bf3873782f9256d4a Mon Sep 17 00:00:00 2001 From: Akemi Date: Tue, 13 Dec 2016 18:44:57 +0100 Subject: cocoa: support append file to paylist on drop When dropping a file on mpv, either on the window or the App bundle icon, while holding the shift key the dropped files will be appended to the playlist. Fixes #2166 --- osdep/macosx_events.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'osdep') diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index 6ad22584dc..c493c58c96 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -462,6 +462,9 @@ void cocoa_set_input_context(struct input_ctx *input_context) - (void)handleFilesArray:(NSArray *)files { + enum mp_dnd_action action = [NSEvent modifierFlags] & + NSEventModifierFlagShift ? DND_APPEND : DND_REPLACE; + size_t num_files = [files count]; char **files_utf8 = talloc_array(NULL, char*, num_files); [files enumerateObjectsUsingBlock:^(NSString *p, NSUInteger i, BOOL *_){ @@ -473,7 +476,7 @@ void cocoa_set_input_context(struct input_ctx *input_context) }]; [_input_lock lock]; if (_inputContext) - mp_event_drop_files(_inputContext, num_files, files_utf8, DND_REPLACE); + mp_event_drop_files(_inputContext, num_files, files_utf8, action); [_input_lock unlock]; talloc_free(files_utf8); } -- cgit v1.2.3