Преглед изворни кода

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.
Jon Topper пре 5 година
родитељ
комит
87e90ee8a4
1 измењених фајлова са 10 додато и 2 уклоњено
  1. 10 2
      UI/platform-osx.mm

+ 10 - 2
UI/platform-osx.mm

@@ -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();