0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

UI: Make macOS 'always on top' more aggressive

Applications like Keynote, in full screen mode, cover up OBS.

This change forces windows that have been set as 'always on top' (eg.
projector windows) to sit above Keynote's full screen view by
manipulating the NSWindow's level attribute.
This commit is contained in:
Jon Topper 2020-07-27 19:07:35 +01:00 committed by jp9000
parent a41048b486
commit 87e90ee8a4

View File

@ -148,10 +148,18 @@ void SetAlwaysOnTop(QWidget *window, bool enable)
{
Qt::WindowFlags flags = window->windowFlags();
if (enable)
if (enable) {
/* Force the level of the window high so it sits on top of
* full-screen applications like Keynote */
NSView *nsv = (__bridge NSView *)reinterpret_cast<void *>(
window->winId());
NSWindow *nsw = nsv.window;
[nsw setLevel:1024];
flags |= Qt::WindowStaysOnTopHint;
else
} else {
flags &= ~Qt::WindowStaysOnTopHint;
}
window->setWindowFlags(flags);
window->show();