[LyX/master] #11756 cleanup the view menu on Mac

Stephan Witt switt at lyx.org
Sun Aug 30 13:20:19 UTC 2020


commit 292799a4bd3fead1d631678a94a4eccc89193201
Author: Stephan Witt <switt at lyx.org>
Date:   Sun Aug 30 15:34:44 2020 +0200

    #11756 cleanup the view menu on Mac
    
    Using US english desktop language LyX's Mac OS adds some items to the view menu:
    1. Show/Hide Tab Bar and
    2. Enter Full Screen
    These items won't work properly and it's better to hide them.
---
 src/frontends/qt/GuiApplication.cpp |    1 +
 src/support/AppleSupport.h          |    1 +
 src/support/AppleSupport.m          |   12 ++++++++++++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 64d2577..eb92be7 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -1034,6 +1034,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
 	///
 	setupApplescript();
 	appleCleanupEditMenu();
+	appleCleanupViewMenu();
 #endif
 
 #if defined(Q_WS_X11) || defined(QPA_XCB)
diff --git a/src/support/AppleSupport.h b/src/support/AppleSupport.h
index a6da335..ef055cb 100644
--- a/src/support/AppleSupport.h
+++ b/src/support/AppleSupport.h
@@ -16,6 +16,7 @@
 extern "C" {
 #endif
 	void appleCleanupEditMenu();
+	void appleCleanupViewMenu();
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/support/AppleSupport.m b/src/support/AppleSupport.m
index 4cac559..edbede4 100644
--- a/src/support/AppleSupport.m
+++ b/src/support/AppleSupport.m
@@ -19,5 +19,17 @@ void appleCleanupEditMenu() {
 
 	[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledDictationMenuItem"];
 	[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"NSDisabledCharacterPaletteMenuItem"];
+}
+
+
+void appleCleanupViewMenu() {
+
+#ifdef AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
+	// Remove the "Show Tab Bar" menu item from the "View" menu, if supported
+	if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
+		NSWindow.allowsAutomaticWindowTabbing = NO;
+#endif
 
+	// Remove the "Enter Full Screen" menu item from the "View" menu
+	[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
 }


More information about the lyx-cvs mailing list