summaryrefslogtreecommitdiffstats
path: root/video/out/gl_cocoa.c
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-03-04 14:23:06 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-12 15:27:54 +0200
commit134f3e97bf482b75c0eccbe5ac943a2a1d5a4ad6 (patch)
tree98bac431df2697072238864e48a0380d3b1745ff /video/out/gl_cocoa.c
parentafdc9c4ae2e69a9ced6c3c6580df19edfedea36a (diff)
downloadmpv-134f3e97bf482b75c0eccbe5ac943a2a1d5a4ad6.tar.bz2
mpv-134f3e97bf482b75c0eccbe5ac943a2a1d5a4ad6.tar.xz
OSX: run native event loop in a separate thread
This commit is a followup on the previous one and uses a solution I like more since it totally decouples the Cocoa code from mpv's core and tries to emulate a generic Cocoa application's lifecycle as much as possible without fighting the framework. mpv's main is executed in a pthread while the main thread runs the native cocoa event loop. All of the thread safety is mainly accomplished with additional logic in cocoa_common as to not increase complexity on the crossplatform parts of the code.
Diffstat (limited to 'video/out/gl_cocoa.c')
-rw-r--r--video/out/gl_cocoa.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/video/out/gl_cocoa.c b/video/out/gl_cocoa.c
index 81be21da58..dd8b5a865a 100644
--- a/video/out/gl_cocoa.c
+++ b/video/out/gl_cocoa.c
@@ -51,6 +51,11 @@ static void swapGlBuffers_cocoa(MPGLContext *ctx)
vo_cocoa_swap_buffers(ctx->vo);
}
+static void set_current_cocoa(MPGLContext *ctx, bool current)
+{
+ vo_cocoa_set_current_context(ctx->vo, current);
+}
+
void mpgl_set_backend_cocoa(MPGLContext *ctx)
{
ctx->config_window = config_window_cocoa;
@@ -63,5 +68,8 @@ void mpgl_set_backend_cocoa(MPGLContext *ctx)
ctx->vo_init = vo_cocoa_init;
ctx->pause = vo_cocoa_pause;
ctx->resume = vo_cocoa_resume;
+ ctx->register_resize_callback = vo_cocoa_register_resize_callback;
ctx->vo_uninit = vo_cocoa_uninit;
+ ctx->set_current = set_current_cocoa;
+ ctx->set_current = set_current_cocoa;
}