瀏覽代碼

UI: Remove macOS-Default Full Screen Menu Item

macOS looks if the NSUserDefault NSFullScreenMenuItemEverywhere is set
to true, and if it is, it adds its own full screen menu item.
Sets this NSUserDefault to false since it defaults to true.
gxalpha 4 年之前
父節點
當前提交
cf445be44c
共有 3 個文件被更改,包括 12 次插入0 次删除
  1. 4 0
      UI/obs-app.cpp
  2. 7 0
      UI/platform-osx.mm
  3. 1 0
      UI/platform.hpp

+ 4 - 0
UI/obs-app.cpp

@@ -2674,6 +2674,10 @@ int main(int argc, char *argv[])
 	}
 #endif
 
+#ifdef __APPLE__
+	DisableFullScreenViewMenuItem();
+#endif
+
 #ifdef _WIN32
 	obs_init_win32_crash_handler();
 	SetErrorMode(SEM_FAILCRITICALERRORS);

+ 7 - 0
UI/platform-osx.mm

@@ -235,6 +235,13 @@ void EnableOSXDockIcon(bool enable)
 				NSApplicationActivationPolicyProhibited];
 }
 
+void DisableFullScreenViewMenuItem()
+{
+	[[NSUserDefaults standardUserDefaults]
+		setBool:NO
+		 forKey:@"NSFullScreenMenuItemEverywhere"];
+}
+
 /*
  * This custom NSApplication subclass makes the app compatible with CEF. Qt
  * also has an NSApplication subclass, but it doesn't conflict thanks to Qt

+ 1 - 0
UI/platform.hpp

@@ -69,6 +69,7 @@ void EnableOSXDockIcon(bool enable);
 void InstallNSApplicationSubclass();
 void disableColorSpaceConversion(QWidget *window);
 void CheckAppWithSameBundleID(bool &already_running);
+void DisableFullScreenViewMenuItem();
 #endif
 #ifdef __linux__
 void RunningInstanceCheck(bool &already_running);