mac: add ontop window level for desktop

this puts the window ontop of the desktop but behind the desktop icons.

Fixes #7791
This commit is contained in:
der richter 2020-09-15 16:24:36 +02:00
parent 3054bcc62c
commit e28724d90d
3 changed files with 9 additions and 4 deletions

View File

@ -2940,12 +2940,13 @@ Window
treated as exclusive fullscreen window that bypasses the Desktop Window
Manager.
``--ontop-level=<window|system|level>``
``--ontop-level=<window|system|desktop|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``

View File

@ -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)},

View File

@ -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
}