From e28724d90d9d62c01c13d7da8ff2f10b490fc8ae Mon Sep 17 00:00:00 2001 From: der richter Date: Tue, 15 Sep 2020 16:24:36 +0200 Subject: mac: add ontop window level for desktop this puts the window ontop of the desktop but behind the desktop icons. Fixes #7791 --- DOCS/man/options.rst | 3 ++- options/options.c | 4 ++-- video/out/mac/window.swift | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index ed0b38c719..75a7871c4a 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -2940,12 +2940,13 @@ Window treated as exclusive fullscreen window that bypasses the Desktop Window Manager. -``--ontop-level=`` +``--ontop-level=`` (OS X only) Sets the level of an ontop window (default: window). :window: On top of all other windows. :system: On top of system elements like Taskbar, Menubar and Dock. + :desktop: On top of the Dekstop behind windows and Desktop icons. :level: A level as integer. ``--border``, ``--no-border`` diff --git a/options/options.c b/options/options.c index 88b78565ed..e1bc5a3c47 100644 --- a/options/options.c +++ b/options/options.c @@ -109,8 +109,8 @@ static const m_option_t mp_vo_opt_list[] = { {"taskbar-progress", OPT_FLAG(taskbar_progress)}, {"snap-window", OPT_FLAG(snap_window)}, {"ontop", OPT_FLAG(ontop)}, - {"ontop-level", OPT_CHOICE(ontop_level, {"window", -1}, {"system", -2}), - M_RANGE(0, INT_MAX)}, + {"ontop-level", OPT_CHOICE(ontop_level, {"window", -1}, {"system", -2}, + {"desktop", -3}), M_RANGE(0, INT_MAX)}, {"border", OPT_FLAG(border)}, {"fit-border", OPT_FLAG(fit_border)}, {"on-all-workspaces", OPT_FLAG(all_workspaces)}, diff --git a/video/out/mac/window.swift b/video/out/mac/window.swift index 5b7e77dcff..d692d0db91 100644 --- a/video/out/mac/window.swift +++ b/video/out/mac/window.swift @@ -262,6 +262,8 @@ class Window: NSWindow, NSWindowDelegate { level = .floating case -2: level = .statusBar + 1 + case -3: + level = NSWindow.Level(Int(CGWindowLevelForKey(.desktopWindow))) default: level = NSWindow.Level(ontopLevel) } @@ -416,7 +418,9 @@ class Window: NSWindow, NSWindowDelegate { } override func constrainFrameRect(_ frameRect: NSRect, to tScreen: NSScreen?) -> NSRect { - if (isAnimating && !isInFullscreen) || (!isAnimating && isInFullscreen) { + if (isAnimating && !isInFullscreen) || (!isAnimating && isInFullscreen || + level == NSWindow.Level(Int(CGWindowLevelForKey(.desktopWindow)))) + { return frameRect } -- cgit v1.2.3