cocoa: ignore first file open events from command line

similar to some of the code deleted in 685b8b7a but simpler
This commit is contained in:
Stefano Pigozzi
2014-12-07 21:39:26 +01:00
parent fab64fd3cf
commit fc7731983e
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -61,6 +61,7 @@ Application *mpv_shared_app(void)
@implementation Application
@synthesize menuItems = _menu_items;
@synthesize openCount = _open_count;
- (void)sendEvent:(NSEvent *)event
{
@@ -231,6 +232,10 @@ Application *mpv_shared_app(void)
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
if (mpv_shared_app().openCount > 0) {
mpv_shared_app().openCount--;
return;
}
SEL cmpsel = @selector(localizedStandardCompare:);
NSArray *files = [filenames sortedArrayUsingSelector:cmpsel];
[_eventsResponder handleFilesArray:files];
@@ -371,6 +376,9 @@ int cocoa_main(mpv_main_fn mpv_main, int argc, char *argv[])
macosx_redirect_output_to_logfile("mpv");
init_cocoa_application(true);
} else {
for (int i = 1; i < argc; i++)
if (argv[i][0] != '-')
mpv_shared_app().openCount++;
init_cocoa_application(false);
}
+1
View File
@@ -26,6 +26,7 @@
@property(nonatomic, retain) NSMutableDictionary *menuItems;
@property(nonatomic, retain) NSArray *files;
@property(nonatomic, assign) size_t openCount;
@end
Application *mpv_shared_app(void);