summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2014-12-07 21:39:26 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2014-12-07 21:39:26 +0100
commitfc7731983ee82e07fbc8835d2b94c40fdda2da81 (patch)
treeb7052779a3a95229adac682351e7a5418311bfe1
parentfab64fd3cfc983013fb5bdb6c319660be0f209d0 (diff)
downloadmpv-fc7731983ee82e07fbc8835d2b94c40fdda2da81.tar.bz2
mpv-fc7731983ee82e07fbc8835d2b94c40fdda2da81.tar.xz
cocoa: ignore first file open events from command line
similar to some of the code deleted in 685b8b7a but simpler
-rw-r--r--osdep/macosx_application.m8
-rw-r--r--osdep/macosx_application_objc.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m
index 98d00244fb..fa5058fd1d 100644
--- a/osdep/macosx_application.m
+++ b/osdep/macosx_application.m
@@ -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);
}
diff --git a/osdep/macosx_application_objc.h b/osdep/macosx_application_objc.h
index 2383ba810c..6b0ca15c2e 100644
--- a/osdep/macosx_application_objc.h
+++ b/osdep/macosx_application_objc.h
@@ -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);