From 64b0d81c32d90fe29485bdb218fb76608b9aa31b Mon Sep 17 00:00:00 2001 From: Akemi Date: Mon, 13 Feb 2017 20:08:43 +0100 Subject: cocoa: add --ontop-level option for modifying ontop window level since there are different views on what ontop is, we make the ontop window level modifiable. at the moment only support for macOS was added. the default for macOS was changed from 'system' to 'window' since this fixes an unwanted behaviour in fullscreen and in general causes less issues with expected behaviour. Fixes #2376 #3974 --- video/out/cocoa_common.m | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'video/out/cocoa_common.m') diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 0420b0dda2..45581ec191 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -474,14 +474,21 @@ static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt return kCVReturnSuccess; } -static void vo_set_level(struct vo *vo, int ontop) +static void vo_set_level(struct vo *vo, int ontop, int ontop_level) { struct vo_cocoa_state *s = vo->cocoa; if (ontop) { - // +1 is not enough as that will show the icon layer on top of the - // menubar when the application is not frontmost. so use +2 - s->window_level = NSMainMenuWindowLevel + 2; + switch (ontop_level) { + case -1: + s->window_level = NSFloatingWindowLevel; + break; + case -2: + s->window_level = NSStatusWindowLevel; + break; + default: + s->window_level = ontop_level; + } } else { s->window_level = NSNormalWindowLevel; } @@ -499,7 +506,7 @@ static int vo_cocoa_ontop(struct vo *vo) return VO_NOTIMPL; struct mp_vo_opts *opts = vo->opts; - vo_set_level(vo, opts->ontop); + vo_set_level(vo, opts->ontop, opts->ontop_level); return VO_TRUE; } @@ -679,7 +686,7 @@ int vo_cocoa_config_window(struct vo *vo) if (opts->fullscreen && !s->fullscreen) vo_cocoa_fullscreen(vo); cocoa_set_window_title(vo); - vo_set_level(vo, opts->ontop); + vo_set_level(vo, opts->ontop, opts->ontop_level); GLint o; if (!CGLGetParameter(s->cgl_ctx, kCGLCPSurfaceOpacity, &o) && !o) { -- cgit v1.2.3