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 treated as exclusive fullscreen window that bypasses the Desktop Window
Manager. Manager.
``--ontop-level=<window|system|level>`` ``--ontop-level=<window|system|desktop|level>``
(OS X only) (OS X only)
Sets the level of an ontop window (default: window). Sets the level of an ontop window (default: window).
:window: On top of all other windows. :window: On top of all other windows.
:system: On top of system elements like Taskbar, Menubar and Dock. :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. :level: A level as integer.
``--border``, ``--no-border`` ``--border``, ``--no-border``

View File

@ -109,8 +109,8 @@ static const m_option_t mp_vo_opt_list[] = {
{"taskbar-progress", OPT_FLAG(taskbar_progress)}, {"taskbar-progress", OPT_FLAG(taskbar_progress)},
{"snap-window", OPT_FLAG(snap_window)}, {"snap-window", OPT_FLAG(snap_window)},
{"ontop", OPT_FLAG(ontop)}, {"ontop", OPT_FLAG(ontop)},
{"ontop-level", OPT_CHOICE(ontop_level, {"window", -1}, {"system", -2}), {"ontop-level", OPT_CHOICE(ontop_level, {"window", -1}, {"system", -2},
M_RANGE(0, INT_MAX)}, {"desktop", -3}), M_RANGE(0, INT_MAX)},
{"border", OPT_FLAG(border)}, {"border", OPT_FLAG(border)},
{"fit-border", OPT_FLAG(fit_border)}, {"fit-border", OPT_FLAG(fit_border)},
{"on-all-workspaces", OPT_FLAG(all_workspaces)}, {"on-all-workspaces", OPT_FLAG(all_workspaces)},

View File

@ -262,6 +262,8 @@ class Window: NSWindow, NSWindowDelegate {
level = .floating level = .floating
case -2: case -2:
level = .statusBar + 1 level = .statusBar + 1
case -3:
level = NSWindow.Level(Int(CGWindowLevelForKey(.desktopWindow)))
default: default:
level = NSWindow.Level(ontopLevel) level = NSWindow.Level(ontopLevel)
} }
@ -416,7 +418,9 @@ class Window: NSWindow, NSWindowDelegate {
} }
override func constrainFrameRect(_ frameRect: NSRect, to tScreen: NSScreen?) -> NSRect { 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 return frameRect
} }