提交 8e03e031 编写于 作者: Z zhuowei 提交者: Benjamin Pasero

Fix #35361: fix native tabs on macOS 10.13 (#52775)

* Fix #35361: fix native tabs on macOS 10.13

macOS 10.13 mistakenly enables a compatibility option on VS Code
and VS Code Insiders because their bundle IDs begin with
"com.microsoft.". This breaks native tabs.

Explicitly disable the compatibility patch using NSUserDefaults.

Note that Code-OSS is not affected by the bug, since its bundle ID
is "com.visualstudio.code.oss". To test this behaviour, change
darwinBundleIdentifier in product.json.

* set NSUseImprovedLayoutPass only when window.nativeTabs: true
上级 3669afe7
......@@ -5,7 +5,7 @@
'use strict';
import { app, ipcMain as ipc } from 'electron';
import { app, ipcMain as ipc, systemPreferences } from 'electron';
import * as platform from 'vs/base/common/platform';
import { WindowsManager } from 'vs/code/electron-main/windows';
import { IWindowsService, OpenContext, ActiveWindowManager } from 'vs/platform/windows/common/windows';
......@@ -85,7 +85,7 @@ export class CodeApplication {
@ILogService private logService: ILogService,
@IEnvironmentService private environmentService: IEnvironmentService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IConfigurationService configurationService: ConfigurationService,
@IConfigurationService private configurationService: ConfigurationService,
@IStateService private stateService: IStateService,
@IHistoryMainService private historyMainService: IHistoryMainService
) {
......@@ -274,6 +274,16 @@ export class CodeApplication {
app.setAppUserModelId(product.win32AppUserModelId);
}
// Fix native tabs on macOS 10.13
// macOS enables a compatibility patch for any bundle ID beginning with
// "com.microsoft.", which breaks native tabs for VS Code when using this
// identifier (from the official build).
// Explicitly opt out of the patch here before creating any windows.
// See: https://github.com/Microsoft/vscode/issues/35361#issuecomment-399794085
if (platform.isMacintosh && this.configurationService.getValue<boolean>('window.nativeTabs') === true) {
systemPreferences.registerDefaults({ NSUseImprovedLayoutPass: true });
}
// Create Electron IPC Server
this.electronIpcServer = new ElectronIPCServer();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册