summaryrefslogtreecommitdiffstats
path: root/osdep/macosx_application.m
Commit message (Collapse)AuthorAgeFilesLines
* cocoa-cb: make fullscreen resize animation duration configurableAkemi2018-02-281-0/+7
|
* cocoa-cb: change border and borderless window stylingAkemi2018-02-281-0/+16
| | | | | | | | | | | the title bar is now within the window bounds instead of outside. same as QuickTime Player. it supports several standard styles, two dark and two light ones. additionally we have properly rounded corners now and the borderless window also has the proper window shadow. Also make the earliest supported macOS version 10.10. Fixes #4789, #3944
* cocoa-cb: initial implementation via opengl-cb APIAkemi2018-02-121-22/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this is meant to replace the old and not properly working vo_gpu/opengl cocoa backend in the future. the problems are various shortcomings of Apple's opengl implementation and buggy behaviour in certain circumstances that couldn't be properly worked around. there are also certain regressions on newer macOS versions from 10.11 onwards. - awful opengl performance with a none layer backed context - huge amount of dropped frames with an early context flush - flickering of system elements like the dock or volume indicator - double buffering not properly working with a none layer backed context - bad performance in fullscreen because of system optimisations all the problems were caused by using a normal opengl context, that seems somewhat abandoned by apple, and are fixed by using a layer backed opengl context instead. problems that couldn't be fixed could be properly worked around. this has all features our old backend has sans the wid embedding, the possibility to disable the automatic GPU switching and taking screenshots of the window content. the first was deemed unnecessary by me for now, since i just use the libmpv API that others can use anyway. second is technically not possible atm because we have to pre-allocate our opengl context at a time the config isn't read yet, so we can't get the needed property. third one is a bit tricky because of deadlocking and it needed to be in sync, hopefully i can work around that in the future. this also has at least one additional feature or eye-candy. a properly working fullscreen animation with the native fs. also since this is a direct port of the old backend of the parts that could be used, though with adaptions and improvements, this looks a lot cleaner and easier to understand. some credit goes to @pigoz for the initial swift build support which i could improve upon. Fixes: #5478, #5393, #5152, #5151, #4615, #4476, #3978, #3746, #3739, #2392, #2217
* osx: code cleanups and cosmetic fixesAkemi2018-01-201-1/+1
|
* osx: fix the bundle $PATH yet againAkemi2017-11-111-1/+1
| | | | we have 5 parameters for the string but only 4 were being used.
* osx: add right MacPorts paths to our bundle $PATHAkemi2017-10-071-2/+3
| | | | also add another path for homebrew.
* osx: add some common paths to our $PATH when started from bundleAkemi2017-10-031-0/+8
| | | | | | | | | | | with the previous commit we removed the ability of loading the standard shell environment. this exact behaviour can only be re-added by either invoking the standard shell in a background process and reading it's environment vars or by manually reading all the various shell configs. both ways are kinda dirty and the former was already rejected before. for now we will just add some commonly used paths, when started from the bundle, so it can find the binaries used by mpv again. for example the youtube-dl one for our youtube-dl hook.
* osx: fix bundle on macOS High Sierra (10.13)Akemi2017-10-031-5/+20
| | | | | | | | | | | | | | | | | | | | | | Apple slightly changed the App bundle mechanism which broke wrapper scripts that invoke the actual binary. it caused the bundle to always open a new instance of mpv instead of reusing the currently running one. just removing the wrapper script would lead to several regressions, so it was replaced with a symlink to the bundle binary. detection if mpv was started from the bundle was replaced by comparing the execution name of the binary, eg the name of the symlink "mpv-bundle". additionally, because we load a standard config from the Resources folder of the bundle again, we prevent that config from being loaded if mpv wasn't started via the bundle. the psn argument has to be removed manually again. the ability of loading your standard shell environment has been removed with the wrapper. a substitution will be added with another commit. as a side effect this fixes an issues when zsh was used with common NodeJS configuration scripts. Fixes #4926 #4866
* osx: fix media keys input when other Apps steal the priorityAkemi2017-09-071-0/+5
| | | | | | | | | | | other Apps do the same as mpv and tap into the global event chain. events that are handled are not being propagated down the event chain. that can lead to mpv not getting any media key events anymore when they are held back by other Apps. we will just move mpv back to the top of the event list when mpv is refocused and is not at the top of the list any more. Fixes #4834
* osx: refactor menu bar creationAkemi2017-08-181-1/+6
| | | | | make the menu bar look more like a standard macOS menu bar, with all the standard menu items like About, Help, Open, etc.
* osx: move menu bar creation into its own fileAkemi2017-08-181-130/+4
|
* osx: change license of OSX and cocoa files to LGPLwm42017-06-241-7/+7
| | | | All authors of the current code have agreed.
* osx: fix Touch Bar access on systems without Touch Bar supportAkemi2017-04-021-4/+7
| | | | | | when building with a deployment target older than an SDK with Touch Bar support we still tried to access the TouchBar, since the compile time checks are positive. to prevent this we add two runtime checks.
* osx: fix key input in certain circumstancesAkemi2017-03-261-2/+2
| | | | | | | | | | | | | for a reason i can just assume some key events can vanish from the event chain and mpv seems unresponsive. after quite some testing i could confirm that the events are present at the first entry point of the event chain, the sendEvent method of the Application, and that they vanish at a point afterwards. now we use that entry point to grab keyDown and keyUp events. we also stop propagating those key events to prevent the no key input' error sound. if we ever need the key events somewhere down the event chain we need to start propagating them again. though this is not necessary currently.
* osx: initial Touch Bar supportAkemi2017-03-261-0/+46
|
* osx: improve bundle handlingAkemi2017-02-161-50/+5
| | | | | | | | | | | | | | | | | we have two problems here. first when mpv is started from the bundle it uses its own environment variables and possibly can't find for example the youtube-dl binary for our youtube-dl hook. second we couldn't reliable determine when mpv was started from the bundle, which led to the pseudo-gui usage even when the binary was invoked from a shell. to prevent this we will wrap the bundle binary with a shell script, which will only be called when we start mpv from the bundle. this way we can get the same environment variables, like $PATH, for our bundle and additional we can set the pseudo-gui only when started through this script. it is also possible to detect the bundle usage properly and accurately through the usage of another environment var. Fixes #2061
* cocoa: gracefully quit from the Dock's context menuAkemi2017-02-161-4/+10
| | | | | | | | | | | | quitting mpv from the Dock's context menu leaves the shell in a bad state where you can't see your input any more and other weirdnesses. in a big refactor (afdc9c4) the method to handle this case was actually copied over but the the code to register the event itself was removed or forgotten by accident, leaving some lines of dead code. i re-added the event and slightly adjusted the function. the function was slightly changed so the head of it is consistent with our other events and it is associated with this commit and functionality in the future.
* cocoa: cosmetic fixesAkemi2016-12-161-1/+2
|
* osx: update the menu and remove conflicting itemAkemi2016-12-121-7/+5
| | | | | | | | | | | Remove 'Quit mpv & remember playback position' from the menu because it conflicts with the global logout shortcut. add separator between 'Hide' and 'Quit' for consistency with other Apps. also rename the 'Movie' menu to 'Video'. it's a bit more generic. Fixes #3865
* Use - as command-name separator everywhereTimotej Lazar2016-07-141-1/+1
| | | | | | | Old-style commands using _ as separator (e.g. show_progress) were still used in some places, including documentation and configuration files. This commit updates all such instances to the new style (show-progress) so that commands are easier to find in the manual.
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-111-1/+1
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* osx: never expose input_ctx from EventsResponderwm42015-05-261-9/+2
| | | | Keep it internal, so we can synchronize access to it properly.
* build: move main-fn files to osdepwm42015-05-021-4/+3
| | | | | | And split the Cocoa and Unix cases. Simplify the Cocoa case slightly by calling mpv_main directly, instead of passing a function pointer. Also add a comment explaining why Cocoa needs a special case at all.
* cocoa: always compile OSX application code with cocoawm42015-05-021-8/+15
| | | | | | | | | | | | | | This unbreaks compiling command line player and libmpv at the same time. The problem was that doing so silently disabled the OSX application thing - but the command line player can not use the vo_opengl Cocoa backend without it. The OSX application code is basically dead in libmpv, but it's not that much code anyway. If you want a mpv binary that does not create an OSX application singleton (and creates a menu etc.), you must disable cocoa completely, as cocoa can't be used anyway in this case.
* Update license headersMarcin Kurczewski2015-04-131-2/+1
| | | | Signed-off-by: wm4 <wm4@nowhere>
* osx: terminate argv properly when arguments are removedwm42015-03-061-1/+4
| | | | | | | The player now relies on the (slightly obscure) requirement that argv is NULL-terminated. Might fix #1652.
* cocoa: remove unused functionStefano Pigozzi2015-02-141-7/+0
|
* cocoa: fix exiting the command line playerwm42015-02-131-4/+3
| | | | | | | | Commit e920a00eb assumed that terminate_cocoa_application() actually would exit. But apparently that is not always the case; e.g. mpv --help will just hang. The old code had a dummy exit(0), which was apparently actually called. Fix by explicitly exiting if mpv_main() returns and terminate_cocoa_application() does nothing.
* osx: move cocoa specific call out of common codewm42015-02-121-0/+2
| | | | This is almost equivalent, and gets rid of the ifdef.
* cocoa: ignore first file open events from command lineStefano Pigozzi2014-12-071-0/+8
| | | similar to some of the code deleted in 685b8b7a but simpler
* cocoa: use --idle when running inside bundleStefano Pigozzi2014-12-061-134/+51
| | | | | Previously when using the bundle we used a custom bizarro thing to wait for events. Just use `--idle` and greatly simplify the code.
* cocoa: don't create Dock icon for audio only filesStefano Pigozzi2014-12-051-17/+4
| | | | fixes #635
* cocoa: remove urlencoding for url open eventsStefano Pigozzi2014-12-021-0/+2
| | | | | | This fixes using the mpv:// custom protocol on Yosemite were apparently we receive an url which is automatically urlencoded by the system. /cc mpv-player/stable
* Set thread name for debuggingwm42014-10-191-0/+2
| | | | | | | | | | Especially with other components (libavcodec, OSX stuff), the thread list can get quite populated. Setting the thread name helps when debugging. Since this is not portable, we check the OS variants in waf configure. old-configure just gets a special-case for glibc, since doing a full check here would probably be a waste of effort.
* cocoa: move handleFilesArray: to macosx_eventsFRAU KOUJIRO2014-08-061-16/+1
|
* cocoa: move set_input_context to macosx_eventsFRAU KOUJIRO2014-08-061-5/+0
|
* cocoa: sync inputContext inside EventsResponderFRAU KOUJIRO2014-08-061-8/+2
|
* cocoa: decouple events from application somewhatFRAU KOUJIRO2014-08-061-32/+23
|
* cocoa: fix key equivalent dispatchingStefano Pigozzi2014-07-301-1/+6
| | | | | | | | | | Prior to this commit we had a list of key modifiers and checked against that. Actually, the Cocoa framework has a built in way to do it and it involves calling performKeyEquivalent: on the menu instance. Fixes #946 cc @mpv-player/stable: this should apply with no conflicts
* cocoa: fix deadlock during initialization [2]Stefano Pigozzi2014-02-131-6/+3
| | | | Fixup commit for 20fa191ad.
* cocoa: fix deadlock during initializationStefano Pigozzi2014-02-131-1/+2
| | | | | | Thanks to @wm4 for catching the bug. Fixes #405
* cocoa: sort files opened from Finder the same way Finder doesBilal Syed Hussain2014-01-201-1/+2
| | | | Fixes #497
* cocoa: add application icon to the Dock when run from CLIStefano Pigozzi2014-01-141-0/+16
| | | | | | | | | | Application icon was added to the Dock only when run inside of a bundle. That was handled automatically by OS X using the Info.plist definition. To add the Application icon when run as a CLI program, I used the samme approach in the X11 code and loaded the icon as a static binary blob inside of mpv's binary. This is the simplest approach as it avoid headackes when relocating the binary and such.
* cocoa: refactor files drag and drop on the Dock iconStefano Pigozzi2014-01-041-24/+16
| | | | | Use the newly added `mp_event_drop_files` core function instead of having logic in the platform dependent code.
* macosx_application: replace mp_msg with stderr for semi-fatal errorwm42013-12-211-3/+4
| | | | Apparently this should never be run anyway.
* Fix OSX build; remove all remaining mpvcore references11rcombs2013-12-171-3/+3
|
* cocoa: fix opening quarantined files on 10.9 with the bundle [2]Stefano Pigozzi2013-10-251-2/+2
| | | | Fixup commit for bbc146927
* cocoa: fix opening quarantined files on 10.9 with the bundleStefano Pigozzi2013-10-241-2/+7
| | | | | | | It looks like on Mavericks the Finder is passing different arguments to mpv depending on whether the opened file is quarantined or not. Fixes #285
* cocoa: fix race condition with input context creationStefano Pigozzi2013-10-241-0/+13
| | | | | | | | | | This seems to be a problem only in OS X 10.9. I guess they improved the general speed of the Cocoa startup and suddenly mpv core takes more time than the Cocoa thread to initialize. Fixes #285 (hopefully!)
* osx: fix buildwm42013-09-271-2/+2
| | | | | | Or at least I hope it fixes it, since I can't test. Broken by commit 0d90dd0.
* macosx_application: fix regression causing crashStefano Pigozzi2013-09-191-2/+11
| | | | | 95a2151d1 introduced a crash on systems lower than 10.9 when opening files with a single argument.
* macosx_application: remove deprecation warning on OS X 10.9Nyx0uf2013-09-161-15/+29
| | | | | | | | | | | | GetCurrentProcess() is deprecated on 10.9. Make a universal solution by checking OS version number. get_system_version() function is the recommended Apple way of getting the OS version, since Gestalt is also deprecated (and does pretty much the same thing anyway) Updating HIDRemote.m to use a similar function would allow to get rid of the 2 other warnings.
* macosx_application: fix file opening on 10.9 (for real this time)Stefano Pigozzi2013-09-131-1/+1
| | | | | | | | I did commit 86c05655d by thinking `mpv` already removed the `mpv` from argc/argv. It actually is still there, so the argc must be 1 to check for no arguments. Thanks to @Nyx0uf for pointing out the bug and for testing on 10.9!
* macosx_application: fix file opening on OS X 10.9 (hopefully)Stefano Pigozzi2013-09-121-1/+10
| | | | | | | | File opening through Finder, apparently drops `--psn` arguments on Mavericks and just uses no args. Modify the code to account for that case. This wasn't tested on 10.9 itself (I don't have a paid dev account), but it *should* work if I understood the problem correctly.
* macosx_application: handle mpv:// linksStefano Pigozzi2013-09-071-0/+7
| | | | | | | Pretty useful for people writing userscripts for web browsers. Links starting with 'mpv://' are forwarded to the mpv OSX bundle. The leading 'mpv://' is stripped from the recived url and the rest of the string is inserted as is in the playlist.
* macosx_application: handle URL events as fileopen eventsStefano Pigozzi2013-09-071-0/+30
| | | | | This allows to open URLs directly with mpv. This is useful for streaming and libquvi supported sites.
* cocoa: let the core handle key repeatsStefano Pigozzi2013-08-301-3/+2
| | | | | Report key down and key up modifiers to the core so that it can issue it's own key repeats (instead of relying on Cocoa's ones).
* macosx: remove platform specific input queueStefano Pigozzi2013-08-131-43/+0
| | | | | Since last commit the input queue in the core is thread safe, so there is no need for all this platform specific stuff anymore.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-3/+3
| | | | Followup commit. Fixes all the files references.
* cocoa: remove usage of mp_fifoStefano Pigozzi2013-07-031-6/+0
| | | | | | Update Cocoa parts to remove usage of the mp_fifo internal API to send events to the core and use the input context directly. This is to follow commits the work in commits 70a8079c and d603e73c.
* OSX: fix compilation with 10.7 SDKStefano Pigozzi2013-06-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Recent work in the OS X parts of the code started using clang's support for Obj-C's support for Literals and Subscripting. These particular language features remove a lot of boilerplate code and allow to interact with collections as consicely as one would do in scripting languages like Ruby or Python. Even if these are compiler features, Subscripting needs some runtime support. This is provided with libarclite (coming with the compiler), but we need to add the proper method definitions since the 10.7 SDK headers do not include them. That is because 10.7 shipped before this language features. This will cause some warnings when compiling with the 10.7 SDK because the commit also redefines BOOL to make autoboxing/unboxing of BOOL literals to work. If you need to test this for whatever reason on 10.8, just pass in the correct SDK to configure's extra cflags: ./configure --extra-cflags='-mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' Fixes #117
* osx: improve Media Keys supportStefano Pigozzi2013-06-041-13/+1