Skip to content

Commit

Permalink
cocoa: support append file to paylist on drop
Browse files Browse the repository at this point in the history
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 mpv-player#2166
  • Loading branch information
Akemi committed Dec 13, 2016
1 parent bf5727a commit 3bb0615
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion osdep/macosx_events.m
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,9 @@ - (NSEvent*)handleKey:(NSEvent *)event

- (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 *_){
Expand All @@ -473,7 +476,7 @@ - (void)handleFilesArray:(NSArray *)files
}];
[_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);
}
Expand Down

0 comments on commit 3bb0615

Please sign in to comment.