summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa_common.m
Commit message (Collapse)AuthorAgeFilesLines
* cocoa: fix minimized state getterStefano Pigozzi2015-03-091-5/+2
|
* cocoa: support the "window-minimized" propertyJaime Marquínez Ferrándiz2015-03-081-0/+22
| | | | Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
* cocoa: fix autohide in fullscreenStefano Pigozzi2015-03-081-1/+21
|
* cocoa: fix mouse hiding with launchpad and dock foldersStefano Pigozzi2015-03-081-1/+7
| | | | | | | | | | | | Some UI elements in OS X – like Launchpad and Dock folders – are implemented using borderless windows in background demonized applications. When we use these elements, mpv doesn't stop to be the active application, but the mpv window leaves keyWindow state while we use the OS controls. This commit just keeps track of window state to update the cursor visibility accordingly. Fixes #513
* cocoa: update mouse coordinates when window is initialized.torque2015-03-071-1/+3
| | | | | | Make MpvEventsView -signalMousePosition a public method so it can be called without a compiler warning. Previously, the mouse position would be reported as (0,0) until the cursor was moved.
* cocoa: don't uninit light sensor if not presentStefano Pigozzi2015-03-071-2/+4
|
* cocoa: remove possible use after freeStefano Pigozzi2015-03-071-5/+5
|
* cocoa: fix some crashes caused by async uninitStefano Pigozzi2015-03-071-31/+15
| | | | | | | Always keep around our private state and destroy it when we are really done in the async uninit callback. Fixes #1657
* cocoa: add support for querying ambient lightingStefano Pigozzi2015-03-041-0/+94
| | | | | | | | | This will be pretty useful to let mpv automatically change VO parameters based on ambient lighting conditions. The conversion code and polinomial equation from Apple LMU values to Lux is taken from Firefox: their license, MPL is GPL compatible and allows relicensing to GPL (MPL is more liberal).
* cocoa: remove the setNextKeyView hackStefano Pigozzi2015-02-281-4/+0
| | | | | | Just use makeFirstResponder on the mpv events view from client code if you need the built in keyboard events (this is easier for dealing with view nesting).
* cocoa: improve refresh rate fallback codeStefano Pigozzi2015-02-031-9/+14
| | | | | | | | Apparently CoreGraphics reports the actual refresh rate. DisplayLink can also query the nominal refresh rate of the display so we use that as fallback instead of the fugly 60fps hardcode added in aeb1fca0d. Props to people on https://github.com/glfw/glfw/issues/137
* cocoa: automatically fetch display-fps from the monitorStefano Pigozzi2015-02-031-0/+26
| | | | | | | | | | | | Comment explains why I have been so doubtful at adding this. The Apple docs say CGDisplayModeGetRefreshRate is supposed to work only for CRTs, but it doesn't, and actually works for LCD TVs connected over HDMI and external displays (at least that's what I'm told, I don't have the hardware to test). Maybe Apple docs are incorrect. Since AFAIK Apple doesn't want to give us a better API – maybe in the fear we might be able to actually write some useful software instead of "apps" – I decided not to care as well and commit this.
* video/out: cosmetics: rename VO_EVENT_ICC_PROFILE_PATH_CHANGEDwm42015-01-261-3/+3
| | | | | Remove the "PATH" bit, because VOCTRL_GET_ICC_PROFILE returns an in- memory profile, and not a path. (This was changed a while ago.)
* cocoa: fix fullscreen handlingwm42015-01-171-2/+3
| | | | Fixes #1483, if it even compiles.
* command: unify handling of fullscreen and other VO flagswm42015-01-161-0/+2
| | | | | | | | The "ontop" and "border" properties already used a common mp_property_vo_flag() function, and the corresponding VOCTRLs used the same conventions. "fullscreen" is pretty similar, but was handled slightly similar. Change how VOCTRL_FULLSCREEN behaves, and use the same helper function for "fullscreen" as the other flags.
* cocoa: don't set application icon in libmpvStefano Pigozzi2015-01-161-2/+4
|
* vo_opengl: add support for in memory icc profilesStefano Pigozzi2015-01-071-111/+11
| | | | | | | | | | | Previously we just forced loading a profile from file, but that has poor integration for querying the OS / display server for an ICC profile, and generating profiles on the fly (which we might use in the future for creating preset 3dluts). Also changed the previous icc-profile-auto code to use this mechanism, and moved gl_lcms to be an opaque type with state instead of just providing pure functions.
* cocoa: fix uninitialization while in fullscreenStefano Pigozzi2015-01-011-2/+23
| | | | | | | | This is only needed for switching video track with `_`, since Cocoa automatically handles cleaning up the application's presentation options when quitting the process. Fixes #1399
* cocoa: move the gl function loader to gl_cocoa.cStefano Pigozzi2014-12-281-14/+0
|
* cocoa: mark window for redraw after title changeStefano Pigozzi2014-12-201-1/+3
| | | | | | | This used to work correctly without the call to displayIfNeeded. I think this may only be needed for Yosemite. Fixes #1330
* cocoa: fix crashStefano Pigozzi2014-12-081-5/+0
| | | | | | fixes #1323 Doesn't leak unless we switch video tracks on and off while in fullscreen.
* cocoa: fix view leak in uninit when fullscreenStefano Pigozzi2014-12-061-1/+9
|
* cocoa: use --idle when running inside bundleStefano Pigozzi2014-12-061-4/+1
| | | | | 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 change app activation policy in libmpvStefano Pigozzi2014-12-061-3/+4
| | | /cc @mpv-player/stable
* cocoa: don't create Dock icon for audio only filesStefano Pigozzi2014-12-051-0/+21
| | | | fixes #635
* cocoa: don't async redraw when waiting for VO redrawStefano Pigozzi2014-12-041-1/+3
| | | | | This fixes the very annoying glitch where the black bars disappear for a single frame when going fullscreen.
* vda: use implicit current GL contextStefano Pigozzi2014-12-031-11/+0
| | | | Removes the dependency from the Cocoa backend in case we are not using it but still wanna use VDA GL introp.
* cocoa: allow to black out other display when going fsStefano Pigozzi2014-12-011-0/+5
| | | fixes #1302
* cocoa: don’t hand over view memory ownership to libmpv clientsStefano Pigozzi2014-11-251-1/+1
|
* cocoa: fix fullscreen delay when pausedStefano Pigozzi2014-11-011-2/+2
| | | | | | NSDisableScreenUpdates came to hunt me in the end and when mpv was paused, it did wait for a frame that never came (because of interaction with the live resizing code)!
* build: remove bundle support from wafStefano Pigozzi2014-11-011-0/+1
| | | | Use TOOLS/osxbundle.py instead. It's just better and less hacky.
* cocoa: fix small leakStefano Pigozzi2014-10-271-0/+1
|
* libmpv: cocoa: fix view leak on uninitStefano Pigozzi2014-10-271-4/+6
| | | | | The code was lacking a -removeFromSuperview call which resulted in a leak on our part if the parent view in the client was not released.
* cocoa: perform VOCTRL_SET_UNFS_WINDOW_SIZE asyncronouslyStefano Pigozzi2014-10-241-3/+6
| | | | | | | | Apparently if resizing a NSWindow from a secondary thread Cocoa will automatically protect itself using NSViewHierarchyLock and in our case, cause a deadlock. Fixes #1210
* cocoa: reintroduce async resizeStefano Pigozzi2014-10-181-7/+39
| | | | | | | After removing synchronous libdispatch calls, this looks like it doesn't deadlock anymore. I also experimented with pthread_mutex_trylock liek wm4 suggested, but it leads to some annoying black flickering. I will fallback to that only if some new deadlocks are discovered.
* Revert "cocoa: perform init and uninit synchronously"Stefano Pigozzi2014-10-181-1/+3
| | | | This reverts commit a0ac8b6331d345748d415cf71affbe7a90e336a6.
* cocoa: allow mouse events to bubble up with no-input-cursorStefano Pigozzi2014-10-171-10/+13
| | | | | Previously we didn't report events to the core, but still prevented the events to travel on the responder chain.
* cocoa: perform init and uninit synchronouslyStefano Pigozzi2014-10-161-3/+1
| | | | | This is slightly safer and without the resize redraw, should not cause any deadlock.
* libmpv/cocoa: allow clients to use mpv event systemStefano Pigozzi2014-10-121-25/+27
| | | | | | | | | | This allows mpv's view to take key and send events to mpv's core. To set key status correctly, clients must call -[NSWindow selectNextKeyView:] during reconfig on the main thread. All is 'documented' in the cocoabasic example. If someone knows a better way to handle giving key to the embedded view, let me know!
* cocoa: post keydown and keyup events without event monitorStefano Pigozzi2014-10-091-0/+5
| | | | | Our code worked under the assumption that the event monitor is always active and we did remove the keydown and keyup overrides from our cocoa view.
* cocoa: fix 'uninitalized' accessStefano Pigozzi2014-10-091-9/+7
| | | | | I think this doesn't make a difference, since in Objective-C nil responds as a NullObject, but better not depend on this crappy language feature.
* cocoa: allow to embed into an arbitrary NSViewStefano Pigozzi2014-10-081-12/+27
| | | | | Basically add if guards on all the problematic features. I'm still thinking about a better way to handle this, but for the time being, this will do.
* cocoa: try to fix sizing bugs on retina displaysStefano Pigozzi2014-10-061-2/+2
| | | | untested, no hardware.
* cocoa: separate video view and events viewStefano Pigozzi2014-10-051-7/+16
|
* cocoa: fix fullscreen with bundleStefano Pigozzi2014-10-051-1/+1
|
* cocoa: readd some function callsStefano Pigozzi2014-10-051-1/+3
|
* cocoa: actually reset the event flagsStefano Pigozzi2014-10-051-0/+1
|
* cocoa: remove some useless flagsStefano Pigozzi2014-10-051-19/+10
|
* cocoa: disable some features when embedding in another windowStefano Pigozzi2014-10-051-23/+25
| | | | ontop, fullscreen and window title change to be precise
* cocoa: remove --fs-missioncontrolStefano Pigozzi2014-10-051-15/+2
| | | | | | | This is the first of a series of commits that will change the Cocoa way in a way that is easily embeddable inside parent views. To reach that point common code must avoid referencing the parent NSWindow since that could be the host application's window.
* cocoa: fix some pointer casts to be 32bit safeStefano Pigozzi2014-10-051-1/+1
| | | | credits: wm4
* cocoa/libmpv: allow to embed mpv GL view in another windowStefano Pigozzi2014-10-051-25/+67
| | | | | | | | | | | | | | | | | | | This is just temporary code but is a good base for future work (and baby steps are required for these changes). The 'final destination' is embedding the video view into any NSView but that requires some more work (the mechanism will be the same: pass the view's pointer casted to int64_t through -wid). For instance we will need to remove as much usage of the window instance as possible, and use nil guards where not possible. For this reason I will remove stuff like the mission control fullscreen feature (it's a cute feature but annoying to support and quite limited, go make your GUIs), and a way to lookup the current screen directly from the NSView absolute coordinates (this is needed for ICC detection mostly, and reporting back the screen to mpv's core). Moreover the current view.m will need to be separated into 2 views: the actual video view that will be embedded, and a parent view that will not be embedded and will be responsibile for tracking events.
* cocoa: simplify the config code and run it on the main threadStefano Pigozzi2014-10-051-9/+1
| | | | | | This could be dangerous because we initialize the window asynchronously and return immediately from config, but since the OpenGL context is already created, this seems to work correctly and doesn't cause weird deadlock cases.
* cocoa: don't reset presentation options on uninitStefano Pigozzi2014-10-041-1/+0
| | | | | | This doesn't look to be needed anymore. Fullscreening with both the NSView and the NSWindow API works correctly. I guess this was forgotten in from older code which changed presentation options directly for going fullscreen.
* cocoa: make fullscreening look like an atomic operationStefano Pigozzi2014-10-041-0/+16
| | | | | | | | | | | At the moment when you fullscreen mpv there is a very small time interval where the fullscreen windows is semi-transparent. Apparently whem moving the view to another parent it's better to make Cocoa not draw anything globally. An Apple engineer said it, so it must be correct: http://www.cocoabuilder.com/archive/cocoa/142020-preventing-flicker-on-moving-nsview-to-different-superview.html I know I will regret this in the future.
* cocoa: make resizing wake the vo threadStefano Pigozzi2014-10-041-0/+1
|
* cocoa: remove dead codeStefano Pigozzi2014-10-041-11/+0
|
* cocoa: move to a simpler threading modelStefano Pigozzi2014-10-041-87/+33
| | | | | | | | | | | | | | Unfortunately using dispatch_sync for synchronization turned out to be really bad for us. It caused a wide array of race conditions, deadlocks, etc. Moving to a very simple mutex. It's not clear to me how to do liveresizing with this, for now it just flickers with is unacceptable (maybe I'll draw black instead). This should fix all the threading cocoa bugs. Reopen if it's not the case! Fixes #751 Fixes #1129
* video: rename VOCTRL_GET_WINDOW_SIZEwm42014-09-051-2/+2
| | | | Make it clear that this accesses the un-fullscreened window size.
* cocoa: macosx_application needs cocoa-applicationFRAU KOUJIRO2014-08-061-2/+7
|
* cocoa: move handleFilesArray: to macosx_eventsFRAU KOUJIRO2014-08-061-2/+2
|
* vo: remove vo_mouse_movement() wrapperwm42014-07-271-1/+1
| | | | So that VO backends don't have to access the VO just for that.
* cocoa: don't send messages to uninitialized gl contextsStefano Pigozzi2014-07-191-1/+6
| | | | | | | This should fix some crashes where we sent makeCurrentContext to a context that was being freed from another thread. /cc @mpv-player/stable
* cocoa: fix regression preventing window resizeStefano Pigozzi2014-07-151-1/+3
| | | | | I introduced this bug in b5bbb49. Sorry! This could fix #943 and #930 even though I can't reproduce those specific bugs.
* cocoa: move CGL context creation to gl_cocoaStefano Pigozzi2014-07-081-111/+16
| | | | | | This approach is similar to what other vo_opengl backends do. It can also be used in the future to create another cocoa backend that renders offscreen with IOSurfaces or FBOs.
* cocoa: add fallback for automatic GPU switchingStefano Pigozzi2014-06-151-1/+14
| | | | | | Not all the hardware supports kCGLPFASupportsAutomaticGraphicsSwitching (apparently all Mid-2010 and before MacBooks do not work with it), so fallback to not asking for this attribute in the GL pixel format.
* cocoa: allow automatic gpu switchingStefano Pigozzi2014-06-151-0/+3
| | | | Fixes #820
* cocoa: switch to CGL APIs for GL context creationStefano Pigozzi2014-06-151-16/+23
| | | | | CGL APIs are lower level thus giving us better control and more options for the context creation.
* cocoa: don't use VOCTRL_UPDATE_SCREENINFOwm42014-05-061-18/+23
|
* options: rename video-related options/propertiesMartin Herkt2014-05-041-2/+2
| | | | | | | | | | | Renamed options: --aspect → --video-aspect --fstype → --x11-fstype --native-fs → --fs-missioncontrol --name → --x11-name Renamed properties: aspect → video-aspect
* cocoa: refactor sync scheduling to a functionStefano Pigozzi2014-04-281-14/+18
| | | | | | | | | This extracts the scheduling logic to a single function which is nicer to keep it consistent. Additionally make sure we don't schedule sync operations from a sync operation itself since that could cause deadlocks (even if it should not be happening with the current code).
* cocoa: move sync section assignments in vo_controlRyan Goulden2014-04-281-4/+4
|
* cocoa: cosmetics: use NSMakeSizeRyan Goulden2014-04-281-1/+1
|
* cocoa: fix native fullscreenRyan Goulden2014-04-281-5/+3
| | | | | | | | | | | | | | | | | | | | | | | This fixes a couple of issues with the Cocoa `--native-fs` mode, primarily: - A ghost titlebar at the top of the screen in full screen: This was caused by the window constraining code kicking in during fullscreen. Simply returning the unconstrained rect from the constraining method fixes the problem. - Incorrect behavior when using the titlebar buttons to enter/exit fullscreen, as opposed to the OSD button. This was caused by mpv's internal fullscreen state going out of sync with the NSWindow's one. This was the case because `toggleFullScreen:` completely bypassed the normal event flow that mpv expects. Signed-off-by: Ryan Goulden <percontation@gmail.com> Change style for mpv, simplify and refactor some of the constraining code. Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
*