summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2017-02-13 20:08:43 +0100
committerAkemi <der.richter@gmx.de>2017-02-13 22:49:11 +0100
commit64b0d81c32d90fe29485bdb218fb76608b9aa31b (patch)
treecff0ad349d3d85e8207c5c05b3fcbbe21657fd96 /video
parent34b7d523173a0db0f04fa6904f816e0033662802 (diff)
downloadmpv-64b0d81c32d90fe29485bdb218fb76608b9aa31b.tar.bz2
mpv-64b0d81c32d90fe29485bdb218fb76608b9aa31b.tar.xz
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
Diffstat (limited to 'video')
-rw-r--r--video/out/cocoa_common.m19
1 files changed, 13 insertions, 6 deletions
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) {