From afdc9c4ae2e69a9ced6c3c6580df19edfedea36a Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 23 Feb 2013 18:28:22 +0100 Subject: OSX: use native Cocoa's event loop Schedule mpv's playloop as a high frequency timer inside the main Cocoa event loop. This has the benefit to allow accessing menus as well as resizing the window without the playback being blocked and allows to remove countless hacks from the code that involved manually pumping the event loop as well simulating manually some of the Cocoa default behaviours. A huge improvement consists in removing NSApplicationLoad. This is a C function defined in the Cocoa header and implements a minimal OSX application under ther hood so that you can use the Cocoa GUI toolkit from C/C++ without having to respect the Cocoa standards in terms of application initialization. This was bad because the behaviour implemented by NSApplicationLoad was hard to customize and had several gotchas especially in the menu department. mpv was changed to be just a nib-less application. All the Cocoa part is still generated in code but the event handling is now not dissimilar to what is present in a stock Mac application. As a part of reviewing the initialization process, I also removed all of `osdep/macosx_finder_args`. The useful parts of the code were moved to `osdep/macosx_appication` which has the broaded responsibility of managing the full lifecycle of the Cocoa application. By consequence the `--enable-macosx-finder` configure switch was killed as well, as this feature is always enabled. Another change the users will notice is that when using a bundle the `--quiet` option will be inserted much earlier in the initializaion process. This results in mpv not spamming mpv.log anymore with all the initialization outputs. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9e565c829d..314bbb4fb7 100644 --- a/Makefile +++ b/Makefile @@ -45,10 +45,10 @@ SOURCES-$(LIBBS2B) += audio/filter/af_bs2b.c SOURCES-$(LIBPOSTPROC) += video/filter/vf_pp.c SOURCES-$(LIBSMBCLIENT) += stream/stream_smb.c -SOURCES-$(MACOSX_FINDER) += osdep/macosx_finder_args.m SOURCES-$(MACOSX_BUNDLE) += osdep/macosx_bundle.m SOURCES-$(COCOA) += video/out/osx_common.m \ - video/out/cocoa_common.m + video/out/cocoa_common.m \ + osdep/macosx_application.m SOURCES-$(MNG) += demux/demux_mng.c SOURCES-$(MPG123) += audio/decode/ad_mpg123.c -- cgit v1.2.3