commit 1c5a2fc0eca71488aed2bb7fb3ac34368f4482e5
Author: Stephan Witt <[email protected]>
Date:   Sun Aug 30 11:24:04 2020 +0200

    #11756 hide additional menu items in edit menu on Mac
    
    Mac OS adds two extra menu entries to the edit menu.
    These menu items are:
    1. Start Dictation...
    2. Emoji & Symbols
    Both menu items don't work with LyX.
    Therefore they shouldn't be present and the new code hides them.
---
 src/frontends/qt/GuiApplication.cpp |    2 ++
 src/support/AppleSupport.h          |   23 +++++++++++++++++++++++
 src/support/AppleSupport.m          |   23 +++++++++++++++++++++++
 src/support/CMakeLists.txt          |    1 +
 src/support/Makefile.am             |    2 ++
 5 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/src/frontends/qt/GuiApplication.cpp 
b/src/frontends/qt/GuiApplication.cpp
index 76cf364..64d2577 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -78,6 +78,7 @@
 
 #ifdef Q_OS_MAC
 #include "support/AppleScript.h"
+#include "support/AppleSupport.h"
 #include "support/linkback/LinkBackProxy.h"
 #endif
 
@@ -1032,6 +1033,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
        setQuitOnLastWindowClosed(false);
        ///
        setupApplescript();
+       appleCleanupEditMenu();
 #endif
 
 #if defined(Q_WS_X11) || defined(QPA_XCB)
diff --git a/src/support/AppleSupport.h b/src/support/AppleSupport.h
new file mode 100644
index 0000000..a6da335
--- /dev/null
+++ b/src/support/AppleSupport.h
@@ -0,0 +1,23 @@
+// -*- C++ -*-
+/**
+ * \file AppleSupport.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Stephan Witt
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef LYX_SUPPORT_APPLESUPPORT_H
+#define LYX_SUPPORT_APPLESUPPORT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+       void appleCleanupEditMenu();
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/support/AppleSupport.m b/src/support/AppleSupport.m
new file mode 100644
index 0000000..4cac559
--- /dev/null
+++ b/src/support/AppleSupport.m
@@ -0,0 +1,23 @@
+/**
+ * \file AppleSupport.m
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Stephan Witt
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#import <Cocoa/Cocoa.h>
+#include "AppleSupport.h"
+
+
+void appleCleanupEditMenu() {
+
+       // Remove (disable) the "Start Dictation..." and "Emoji & Symbols" menu 
items
+       // from the "Edit" menu
+
+       [[NSUserDefaults standardUserDefaults] setBool:YES 
forKey:@"NSDisabledDictationMenuItem"];
+       [[NSUserDefaults standardUserDefaults] setBool:YES 
forKey:@"NSDisabledCharacterPaletteMenuItem"];
+
+}
diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt
index 3e9dac5..99b4383 100644
--- a/src/support/CMakeLists.txt
+++ b/src/support/CMakeLists.txt
@@ -12,6 +12,7 @@ list(REMOVE_ITEM support_sources ${moc_files} .)
 if(APPLE)
        list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleSpeller.m)
        list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleScript.m)
+       list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleSupport.m)
 else()
        list(REMOVE_ITEM support_sources 
"${TOP_SRC_DIR}/src/support/AppleScriptProxy.cpp")
 endif()
diff --git a/src/support/Makefile.am b/src/support/Makefile.am
index 6710bcc..785b97f 100644
--- a/src/support/Makefile.am
+++ b/src/support/Makefile.am
@@ -129,6 +129,8 @@ liblyxsupport_a_SOURCES += \
        AppleScript.h \
        AppleScript.m \
        AppleScriptProxy.cpp \
+       AppleSupport.h \
+       AppleSupport.m \
        linkback/LinkBack.h \
        linkback/LinkBack.m \
        linkback/LinkBackProxy.h \
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to