Enable WCO on OSS in main process (#161158)

Fixes #161143
This commit is contained in:
Raymond Zhao
2022-09-19 07:48:16 -07:00
committed by GitHub
parent 65b6256102
commit 0e7735ed70
3 changed files with 7 additions and 8 deletions
+3 -4
View File
@@ -11,7 +11,6 @@ import { ISandboxConfiguration } from 'vs/base/parts/sandbox/common/sandboxTypes
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IEditorOptions } from 'vs/platform/editor/common/editor';
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { FileType } from 'vs/platform/files/common/files';
import { LogLevel } from 'vs/platform/log/common/log';
import { PolicyDefinition, PolicyValue } from 'vs/platform/policy/common/policy';
@@ -164,9 +163,9 @@ export function getTitleBarStyle(configurationService: IConfigurationService): '
return isLinux ? 'native' : 'custom'; // default to custom on all macOS and Windows
}
export function useWindowControlsOverlay(configurationService: IConfigurationService, environmentService: IEnvironmentService): boolean {
if (!isWindows || isWeb || !environmentService.isBuilt) {
return false; // only supported on a built desktop windows instance
export function useWindowControlsOverlay(configurationService: IConfigurationService): boolean {
if (!isWindows || isWeb) {
return false; // only supported on a desktop Windows instance
}
if (getTitleBarStyle(configurationService) === 'native') {
@@ -273,7 +273,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
options.frame = false;
}
if (useWindowControlsOverlay(this.configurationService, this.environmentMainService)) {
if (useWindowControlsOverlay(this.configurationService)) {
// This logic will not perfectly guess the right colors
// to use on initialization, but prefer to keep things
@@ -304,7 +304,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
}
// Update the window controls immediately based on cached values
if (useCustomTitleStyle && ((isWindows && useWindowControlsOverlay(this.configurationService, this.environmentMainService)) || isMacintosh)) {
if (useCustomTitleStyle && ((isWindows && useWindowControlsOverlay(this.configurationService)) || isMacintosh)) {
const cachedWindowControlHeight = this.stateMainService.getItem<number>((CodeWindow.windowControlHeightStateStorageKey));
if (cachedWindowControlHeight) {
this.updateWindowControls({ height: cachedWindowControlHeight });
@@ -222,7 +222,7 @@ export class TitlebarPart extends BrowserTitleBarPart {
super.updateStyles();
// WCO styles only supported on Windows currently
if (useWindowControlsOverlay(this.configurationService, this.environmentService)) {
if (useWindowControlsOverlay(this.configurationService)) {
if (!this.cachedWindowControlStyles ||
this.cachedWindowControlStyles.bgColor !== this.element.style.backgroundColor ||
this.cachedWindowControlStyles.fgColor !== this.element.style.color) {
@@ -234,7 +234,7 @@ export class TitlebarPart extends BrowserTitleBarPart {
override layout(width: number, height: number): void {
super.layout(width, height);
if (useWindowControlsOverlay(this.configurationService, this.environmentService) ||
if (useWindowControlsOverlay(this.configurationService) ||
(isMacintosh && isNative && getTitleBarStyle(this.configurationService) === 'custom')) {
// When the user goes into full screen mode, the height of the title bar becomes 0.
// Instead, set it back to the default titlebar height for Catalina users