mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 06:42:03 +00:00
cocoa: move handleFilesArray: to macosx_events
This commit is contained in:
parent
4fc8dcde2a
commit
0be25a8dbf
@ -22,7 +22,6 @@
|
||||
|
||||
#include "common/msg.h"
|
||||
#include "input/input.h"
|
||||
#include "input/event.h"
|
||||
|
||||
#import "osdep/macosx_application_objc.h"
|
||||
#include "osdep/macosx_compat.h"
|
||||
@ -270,23 +269,9 @@ Application *mpv_shared_app(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (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(_eventsResponder.inputContext, num_files, files_utf8);
|
||||
talloc_free(files_utf8);
|
||||
}
|
||||
|
||||
- (void)handleFiles
|
||||
{
|
||||
[self handleFilesArray:self.files];
|
||||
[_eventsResponder handleFilesArray:self.files];
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
- (void)initialize_menu;
|
||||
- (void)registerSelector:(SEL)selector forKey:(MPMenuKey)key;
|
||||
- (void)stopPlayback;
|
||||
- (void)handleFilesArray:(NSArray *)files;
|
||||
|
||||
@property(nonatomic, retain) NSMutableDictionary *menuItems;
|
||||
@property(nonatomic, retain) NSArray *files;
|
||||
|
@ -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
|
||||
|
@ -30,6 +30,8 @@ struct input_ctx;
|
||||
/// Blocks until inputContext is present.
|
||||
- (void)waitForInputContext;
|
||||
|
||||
- (void)handleFilesArray:(NSArray *)files;
|
||||
|
||||
@property(nonatomic, assign) struct input_ctx *inputContext;
|
||||
|
||||
@end
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "osdep/macosx_compat.h"
|
||||
#include "osdep/macosx_application.h"
|
||||
#include "osdep/macosx_application_objc.h"
|
||||
#include "osdep/macosx_events.h"
|
||||
#include "osdep/macosx_events_objc.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
@ -753,7 +753,7 @@ void *vo_cocoa_cgl_pixel_format(struct vo *vo)
|
||||
|
||||
- (void)handleFilesArray:(NSArray *)files
|
||||
{
|
||||
[mpv_shared_app() handleFilesArray:files];
|
||||
[[EventsResponder sharedInstance] handleFilesArray:files];
|
||||
}
|
||||
|
||||
- (void)didChangeWindowedScreenProfile:(NSScreen *)screen
|
||||
|
Loading…
Reference in New Issue
Block a user