From cf445be44c6707e1e5cef0b5be8afeb03f74bb72 Mon Sep 17 00:00:00 2001 From: gxalpha Date: Fri, 28 May 2021 20:23:53 +0200 Subject: [PATCH] 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. --- UI/obs-app.cpp | 4 ++++ UI/platform-osx.mm | 7 +++++++ UI/platform.hpp | 1 + 3 files changed, 12 insertions(+) diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index a8876a641..fe4e05477 100644 --- a/UI/obs-app.cpp +++ b/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); diff --git a/UI/platform-osx.mm b/UI/platform-osx.mm index c558c7a00..fe1fa2616 100644 --- a/UI/platform-osx.mm +++ b/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 diff --git a/UI/platform.hpp b/UI/platform.hpp index 7e7d47ed1..080139547 100644 --- a/UI/platform.hpp +++ b/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);