mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
#11756 Respect system preferences for tabbing on Mac
This commit is contained in:
parent
ace9fbb6a0
commit
45e8ea4acc
@ -46,6 +46,10 @@
|
||||
#include "support/TempFile.h"
|
||||
#include "support/userinfo.h"
|
||||
|
||||
#ifdef USE_MACOSX_PACKAGING
|
||||
#include "support/AppleSupport.h"
|
||||
#endif
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
@ -286,6 +290,10 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
|
||||
// format prior to 2.0 and introduction of format tag
|
||||
unsigned int rc_format = 0;
|
||||
|
||||
#ifdef USE_MACOSX_PACKAGING
|
||||
open_buffers_in_tabs = appleUserTabbingPreferenceAlways();
|
||||
#endif
|
||||
|
||||
while (lexrc.isOK()) {
|
||||
// By using two switches we take advantage of the compiler
|
||||
// telling us if we have missed a LyXRCTags element in
|
||||
|
@ -17,6 +17,9 @@ extern "C" {
|
||||
#endif
|
||||
void appleCleanupEditMenu();
|
||||
void appleCleanupViewMenu();
|
||||
|
||||
// query the system preferences for users tabbing preference
|
||||
bool appleUserTabbingPreferenceAlways();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -24,12 +24,21 @@ void appleCleanupEditMenu() {
|
||||
|
||||
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
|
||||
// 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
|
||||
if ([NSWindow respondsToSelector:@selector(allowsAutomaticWindowTabbing)])
|
||||
NSWindow.allowsAutomaticWindowTabbing = NO;
|
||||
#endif
|
||||
[NSWindow setAllowsAutomaticWindowTabbing:NO];
|
||||
|
||||
// Remove the "Enter Full Screen" menu item from the "View" menu
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSFullScreenMenuItemEverywhere"];
|
||||
}
|
||||
|
||||
|
||||
bool appleUserTabbingPreferenceAlways() {
|
||||
return [NSWindow respondsToSelector:@selector(userTabbingPreference)] &&
|
||||
[NSWindow userTabbingPreference] == NSWindowUserTabbingPreferenceAlways;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user