Skip to content

Commit 85d939c

Browse files
authored
wco and fullscreen fix (microsoft#167441)
fixes microsoft#167183
1 parent 08c4ffa commit 85d939c

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

src/vs/base/browser/browser.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ export function isStandalone(): boolean {
211211
return standalone;
212212
}
213213

214-
export function isWCOVisible(): boolean {
214+
// Visible means that the feature is enabled, not necessarily being rendered
215+
// e.g. visible is true even in fullscreen mode where the controls are hidden
216+
// See docs at https://developer.mozilla.org/en-US/docs/Web/API/WindowControlsOverlay/visible
217+
export function isWCOEnabled(): boolean {
215218
return (navigator as any)?.windowControlsOverlay?.visible;
216219
}

src/vs/workbench/browser/layout.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
77
import { Event, Emitter } from 'vs/base/common/event';
88
import { EventType, addDisposableListener, getClientArea, Dimension, position, size, IDimension, isAncestorUsingFlowTo, computeScreenAwareSize } from 'vs/base/browser/dom';
9-
import { onDidChangeFullscreen, isFullscreen, isWCOVisible } from 'vs/base/browser/browser';
9+
import { onDidChangeFullscreen, isFullscreen, isWCOEnabled } from 'vs/base/browser/browser';
1010
import { IWorkingCopyBackupService } from 'vs/workbench/services/workingCopy/common/workingCopyBackup';
1111
import { isWindows, isLinux, isMacintosh, isWeb, isNative, isIOS } from 'vs/base/common/platform';
1212
import { EditorInputCapabilities, GroupIdentifier, isResourceEditorInput, IUntypedEditorInput, pathsToEditors } from 'vs/workbench/common/editor';
@@ -1089,7 +1089,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
10891089
}
10901090

10911091
// if WCO is visible, we have to show the title bar
1092-
if (isWCOVisible()) {
1092+
if (isWCOEnabled() && !this.state.runtime.fullscreen) {
10931093
return true;
10941094
}
10951095

@@ -1110,7 +1110,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
11101110
}
11111111

11121112
private shouldShowBannerFirst(): boolean {
1113-
return isWeb && !isWCOVisible();
1113+
return isWeb && !isWCOEnabled();
11141114
}
11151115

11161116
focus(): void {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import 'vs/css!./media/titlebarpart';
77
import { localize } from 'vs/nls';
88
import { Part } from 'vs/workbench/browser/part';
99
import { ITitleService, ITitleProperties } from 'vs/workbench/services/title/common/titleService';
10-
import { getZoomFactor, isWCOVisible } from 'vs/base/browser/browser';
10+
import { getZoomFactor, isWCOEnabled } from 'vs/base/browser/browser';
1111
import { MenuBarVisibility, getTitleBarStyle, getMenuBarVisibility } from 'vs/platform/window/common/window';
1212
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
1313
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
@@ -48,7 +48,7 @@ export class TitlebarPart extends Part implements ITitleService {
4848
readonly minimumWidth: number = 0;
4949
readonly maximumWidth: number = Number.POSITIVE_INFINITY;
5050
get minimumHeight(): number {
51-
const value = this.isCommandCenterVisible || (isWeb && isWCOVisible()) ? 35 : 30;
51+
const value = this.isCommandCenterVisible || (isWeb && isWCOEnabled()) ? 35 : 30;
5252
return value / (this.useCounterZoom ? getZoomFactor() : 1);
5353
}
5454

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { getZoomFactor, isWCOVisible } from 'vs/base/browser/browser';
6+
import { getZoomFactor, isWCOEnabled } from 'vs/base/browser/browser';
77
import { $, addDisposableListener, append, EventType, hide, show } from 'vs/base/browser/dom';
88
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
99
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
@@ -165,7 +165,7 @@ export class TitlebarPart extends BrowserTitleBarPart {
165165
}
166166

167167
// Window Controls (Native Windows/Linux)
168-
if (!isMacintosh && getTitleBarStyle(this.configurationService) !== 'native' && !isWCOVisible() && this.windowControls) {
168+
if (!isMacintosh && getTitleBarStyle(this.configurationService) !== 'native' && !isWCOEnabled() && this.windowControls) {
169169
// Minimize
170170
const minimizeIcon = append(this.windowControls, $('div.window-icon.window-minimize' + Codicon.chromeMinimize.cssSelector));
171171
this._register(addDisposableListener(minimizeIcon, EventType.CLICK, e => {

0 commit comments

Comments
 (0)