2020-08-30 09:24:04 +00:00
|
|
|
/**
|
|
|
|
* \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"];
|
2020-08-30 13:34:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void appleCleanupViewMenu() {
|
|
|
|
|
2022-01-01 17:46:32 +00:00
|
|
|
#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101200)
|
2020-08-30 13:34:44 +00:00
|
|
|
// Remove the "Show Tab Bar" menu item from the "View" menu, if supported
|
2020-08-30 20:25:34 +00:00
|
|
|
// See the Apple developer release notes:
|
|
|
|
// What should an application which already has support for tabbing do?
|
|
|
|
// - The application should explicitly opt-out of automatic window tabbing...
|
|
|
|
// It should respect the userTabbingPreference... see below
|
|
|
|
// https://developer.apple.com/library/archive/releasenotes/AppKit/RN-AppKitOlderNotes/index.html
|
2020-08-30 13:34:44 +00:00
|
|
|
if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
|
2020-08-30 20:25:34 +00:00
|
|
|
[NSWindow setAllowsAutomaticWindowTabbing:NO];
|
2020-08-30 09:24:04 +00:00
|
|
|
|
2020-08-30 13:34:44 +00:00
|
|
|
// Remove the "Enter Full Screen" menu item from the "View" menu
|
|
|
|
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
|
2022-01-01 17:46:32 +00:00
|
|
|
|
|
|
|
#endif
|
2020-08-30 09:24:04 +00:00
|
|
|
}
|
2020-08-30 20:25:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool appleUserTabbingPreferenceAlways() {
|
2022-01-01 17:47:57 +00:00
|
|
|
#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101200)
|
2020-08-30 20:25:34 +00:00
|
|
|
return [NSWindow respondsToSelector:@selector(userTabbingPreference)] &&
|
|
|
|
[NSWindow userTabbingPreference] == NSWindowUserTabbingPreferenceAlways;
|
2022-01-01 17:47:57 +00:00
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
2020-08-30 20:25:34 +00:00
|
|
|
}
|
2022-02-20 12:06:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
int NSTextInsertionPointBlinkPeriodOn() {
|
|
|
|
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
|
|
|
|
|
|
|
|
return [prefs objectForKey:@"NSTextInsertionPointBlinkPeriodOn"] == nil ?
|
|
|
|
-1 : [prefs floatForKey:@"NSTextInsertionPointBlinkPeriodOn"];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int NSTextInsertionPointBlinkPeriodOff() {
|
|
|
|
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
|
|
|
|
|
|
|
|
return [prefs objectForKey:@"NSTextInsertionPointBlinkPeriodOff"] == nil ?
|
|
|
|
-1 : [prefs floatForKey:@"NSTextInsertionPointBlinkPeriodOff"];
|
|
|
|
}
|