diff --git a/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts b/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts index aaf65505c8193..b61767979cbae 100644 --- a/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts @@ -30,9 +30,13 @@ export class TitlebarPart extends BrowserTitleBarPart { private cachedWindowControlStyles: { bgColor: string; fgColor: string } | undefined; private cachedWindowControlHeight: number | undefined; - private getMacTitlebarSize() { + private isBigSurOrNewer(): boolean { const osVersion = this.environmentService.os.release; - if (parseFloat(osVersion) >= 20) { // Big Sur increases title bar height + return parseFloat(osVersion) >= 20; + } + + private getMacTitlebarSize() { + if (this.isBigSurOrNewer()) { // Big Sur increases title bar height return 28; } @@ -232,7 +236,12 @@ export class TitlebarPart extends BrowserTitleBarPart { if (useWindowControlsOverlay(this.configurationService, this.environmentService) || (isMacintosh && isNative && getTitleBarStyle(this.configurationService) === 'custom')) { - const newHeight = Math.round(height * getZoomFactor()); + // 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 + // so that they can have the traffic lights rendered at the proper offset. + // Ref https://github.com/microsoft/vscode/issues/159862 + const newHeight = (height > 0 || this.isBigSurOrNewer()) ? + Math.round(height * getZoomFactor()) : this.getMacTitlebarSize(); if (newHeight !== this.cachedWindowControlHeight) { this.cachedWindowControlHeight = newHeight; this.nativeHostService.updateWindowControls({ height: newHeight });