Skip to content

Commit 4222ce8

Browse files
authored
Enable WCO on all builds (microsoft#167060)
Fixes microsoft#161218 Fixes microsoft#164397
1 parent 59f5d55 commit 4222ce8

File tree

6 files changed

+20
-30
lines changed

6 files changed

+20
-30
lines changed

src/main.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,16 @@ if (locale) {
9999
nlsConfigurationPromise = getNLSConfiguration(product.commit, userDataPath, metaDataFile, locale);
100100
}
101101

102-
if (product.quality === 'insider' || product.quality === 'exploration') {
103-
104-
// Pass in the locale to Electron so that the
105-
// Windows Control Overlay is rendered correctly on Windows,
106-
// and so that the traffic lights are rendered properly
107-
// on macOS when using a custom titlebar.
108-
// If the locale is `qps-ploc`, the Microsoft
109-
// Pseudo Language Language Pack is being used.
110-
// In that case, use `en` as the Electron locale.
111-
112-
const electronLocale = (!locale || locale === 'qps-ploc') ? 'en' : locale;
113-
app.commandLine.appendSwitch('lang', electronLocale);
114-
}
102+
// Pass in the locale to Electron so that the
103+
// Windows Control Overlay is rendered correctly on Windows,
104+
// and so that the traffic lights are rendered properly
105+
// on macOS when using a custom titlebar.
106+
// If the locale is `qps-ploc`, the Microsoft
107+
// Pseudo Language Language Pack is being used.
108+
// In that case, use `en` as the Electron locale.
109+
110+
const electronLocale = (!locale || locale === 'qps-ploc') ? 'en' : locale;
111+
app.commandLine.appendSwitch('lang', electronLocale);
115112

116113
// Load our code once ready
117114
app.once('ready', function () {
@@ -576,8 +573,7 @@ async function resolveNlsConfiguration() {
576573
// VS Code moves to Electron 22.
577574
// Ref https://github.com/microsoft/vscode/issues/159813
578575
// and https://github.com/electron/electron/pull/36035
579-
if ((product.quality === 'insider' || product.quality === 'exploration')
580-
&& 'getPreferredSystemLanguages' in app
576+
if ('getPreferredSystemLanguages' in app
581577
&& typeof app.getPreferredSystemLanguages === 'function'
582578
&& app.getPreferredSystemLanguages().length) {
583579
appLocale = app.getPreferredSystemLanguages()[0];

src/vs/platform/window/common/window.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
1414
import { FileType } from 'vs/platform/files/common/files';
1515
import { LogLevel } from 'vs/platform/log/common/log';
1616
import { PolicyDefinition, PolicyValue } from 'vs/platform/policy/common/policy';
17-
import { IProductService } from 'vs/platform/product/common/productService';
1817
import { IPartsSplash } from 'vs/platform/theme/common/themeService';
1918
import { IUserDataProfile } from 'vs/platform/userDataProfile/common/userDataProfile';
2019
import { IAnyWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
@@ -164,7 +163,7 @@ export function getTitleBarStyle(configurationService: IConfigurationService): '
164163
return isLinux ? 'native' : 'custom'; // default to custom on all macOS and Windows
165164
}
166165

167-
export function useWindowControlsOverlay(configurationService: IConfigurationService, productService: IProductService): boolean {
166+
export function useWindowControlsOverlay(configurationService: IConfigurationService): boolean {
168167
if (!isWindows || isWeb) {
169168
return false; // only supported on a desktop Windows instance
170169
}
@@ -178,9 +177,8 @@ export function useWindowControlsOverlay(configurationService: IConfigurationSer
178177
return configuredUseWindowControlsOverlay;
179178
}
180179

181-
// Default to true for Insider and Exploration to match with
182-
// app.getPreferredSystemLanguages() only being available on those builds.
183-
return productService.quality === 'insider' || productService.quality === 'exploration';
180+
// Default to true.
181+
return true;
184182
}
185183

186184
export interface IPath<T = IEditorOptions> extends IPathData<T> {

src/vs/platform/windows/electron-main/windowImpl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
285285
options.frame = false;
286286
}
287287

288-
if (useWindowControlsOverlay(this.configurationService, this.productService)) {
288+
if (useWindowControlsOverlay(this.configurationService)) {
289289

290290
// This logic will not perfectly guess the right colors
291291
// to use on initialization, but prefer to keep things
@@ -316,7 +316,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
316316
}
317317

318318
// Update the window controls immediately based on cached values
319-
if (useCustomTitleStyle && ((isWindows && useWindowControlsOverlay(this.configurationService, this.productService)) || isMacintosh)) {
319+
if (useCustomTitleStyle && ((isWindows && useWindowControlsOverlay(this.configurationService)) || isMacintosh)) {
320320
const cachedWindowControlHeight = this.stateMainService.getItem<number>((CodeWindow.windowControlHeightStateStorageKey));
321321
if (cachedWindowControlHeight) {
322322
this.updateWindowControls({ height: cachedWindowControlHeight });

src/vs/workbench/browser/parts/titlebar/titlebarPart.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import { IHoverDelegate } from 'vs/base/browser/ui/iconLabel/iconHoverDelegate';
3636
import { IHoverService } from 'vs/workbench/services/hover/browser/hover';
3737
import { Categories } from 'vs/platform/action/common/actionCommonCategories';
3838
import { MenuWorkbenchToolBar } from 'vs/platform/actions/browser/toolbar';
39-
import { IProductService } from 'vs/platform/product/common/productService';
4039

4140
export class TitlebarPart extends Part implements ITitleService {
4241

@@ -90,7 +89,6 @@ export class TitlebarPart extends Part implements ITitleService {
9089
@IConfigurationService protected readonly configurationService: IConfigurationService,
9190
@IBrowserWorkbenchEnvironmentService protected readonly environmentService: IBrowserWorkbenchEnvironmentService,
9291
@IInstantiationService protected readonly instantiationService: IInstantiationService,
93-
@IProductService protected readonly productService: IProductService,
9492
@IThemeService themeService: IThemeService,
9593
@IStorageService storageService: IStorageService,
9694
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,

src/vs/workbench/electron-sandbox/desktop.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ import product from 'vs/platform/product/common/product';
207207
},
208208
'window.experimental.windowControlsOverlay.enabled': {
209209
'type': 'boolean',
210-
'default': product.quality === 'insider' || product.quality === 'exploration', // switch back to true when app.getLocale() isn't used anymore.
210+
'default': true,
211211
'scope': ConfigurationScope.APPLICATION,
212212
'description': localize('windowControlsOverlay', "Use window controls provided by the platform instead of our HTML-based window controls. Changes require a full restart to apply."),
213213
'included': isWindows

src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
2222
import { Codicon } from 'vs/base/common/codicons';
2323
import { NativeMenubarControl } from 'vs/workbench/electron-sandbox/parts/titlebar/menubarControl';
2424
import { IHoverService } from 'vs/workbench/services/hover/browser/hover';
25-
import { IProductService } from 'vs/platform/product/common/productService';
2625

2726
export class TitlebarPart extends BrowserTitleBarPart {
2827
private maxRestoreControl: HTMLElement | undefined;
@@ -59,7 +58,6 @@ export class TitlebarPart extends BrowserTitleBarPart {
5958
@IConfigurationService configurationService: IConfigurationService,
6059
@INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService,
6160
@IInstantiationService instantiationService: IInstantiationService,
62-
@IProductService productService: IProductService,
6361
@IThemeService themeService: IThemeService,
6462
@IStorageService storageService: IStorageService,
6563
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
@@ -68,7 +66,7 @@ export class TitlebarPart extends BrowserTitleBarPart {
6866
@INativeHostService private readonly nativeHostService: INativeHostService,
6967
@IHoverService hoverService: IHoverService,
7068
) {
71-
super(contextMenuService, configurationService, environmentService, instantiationService, productService, themeService, storageService, layoutService, contextKeyService, hostService, hoverService);
69+
super(contextMenuService, configurationService, environmentService, instantiationService, themeService, storageService, layoutService, contextKeyService, hostService, hoverService);
7270

7371
this.environmentService = environmentService;
7472
}
@@ -218,7 +216,7 @@ export class TitlebarPart extends BrowserTitleBarPart {
218216
super.updateStyles();
219217

220218
// WCO styles only supported on Windows currently
221-
if (useWindowControlsOverlay(this.configurationService, this.productService)) {
219+
if (useWindowControlsOverlay(this.configurationService)) {
222220
if (!this.cachedWindowControlStyles ||
223221
this.cachedWindowControlStyles.bgColor !== this.element.style.backgroundColor ||
224222
this.cachedWindowControlStyles.fgColor !== this.element.style.color) {
@@ -230,7 +228,7 @@ export class TitlebarPart extends BrowserTitleBarPart {
230228
override layout(width: number, height: number): void {
231229
super.layout(width, height);
232230

233-
if (useWindowControlsOverlay(this.configurationService, this.productService) ||
231+
if (useWindowControlsOverlay(this.configurationService) ||
234232
(isMacintosh && isNative && getTitleBarStyle(this.configurationService) === 'custom')) {
235233
// When the user goes into full screen mode, the height of the title bar becomes 0.
236234
// Instead, set it back to the default titlebar height for Catalina users

0 commit comments

Comments
 (0)