#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.
This commit is contained in:
Stephan Witt 2020-08-30 11:24:04 +02:00
parent 784139da50
commit 1c5a2fc0ec
5 changed files with 51 additions and 0 deletions

View File

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

View File

@ -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

View File

@ -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"];
}

View File

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

View File

@ -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 \