summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2016-12-13 18:44:57 +0100
committerAkemi <der.richter@gmx.de>2016-12-14 00:34:16 +0100
commit3bb06155c9c02fb662aa012bf3873782f9256d4a (patch)
tree0985abac8e104892df8ea6b87b1cee9e9cb16c00
parentbf5727a60fbae12510238c23a38b89822b128baa (diff)
downloadmpv-3bb06155c9c02fb662aa012bf3873782f9256d4a.tar.bz2
mpv-3bb06155c9c02fb662aa012bf3873782f9256d4a.tar.xz
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
-rw-r--r--osdep/macosx_events.m5
1 files changed, 4 insertions, 1 deletions
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);
}