mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 20:27:23 +00:00
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
This commit is contained in:
parent
bf5727a60f
commit
3bb06155c9
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user