diff options
author | SteVen Batten <6561887+sbatten@users.noreply.github.com> | 2022-11-10 17:57:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-10 17:57:20 +0300 |
commit | 7c96708170246a9be717204a939924ade5cff695 (patch) | |
tree | a577238c58ea9aac9d5034d6c255972cd9ff31cc | |
parent | af497b4218106926ecce5a55faa30f8bcbb38388 (diff) |
fix title bar when transitioning to PWA (#165967)
fixes #165955
-rw-r--r-- | src/vs/workbench/browser/layout.ts | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts index dad7e8019da..4fea2f88c47 100644 --- a/src/vs/workbench/browser/layout.ts +++ b/src/vs/workbench/browser/layout.ts @@ -299,6 +299,11 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi // Window focus changes this._register(this.hostService.onDidChangeFocus(e => this.onWindowFocusChanged(e))); + + // WCO changes + if (isWeb && typeof (navigator as any).windowControlsOverlay === 'object') { + this._register(addDisposableListener((navigator as any).windowControlsOverlay, 'geometrychange', () => this.onDidChangeWCO())); + } } private onMenubarToggled(visible: boolean): void { @@ -1104,6 +1109,10 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi } } + private shouldShowBannerFirst(): boolean { + return isWeb && !isWCOVisible(); + } + focus(): void { this.focusPart(Parts.EDITOR_PART); } @@ -2008,6 +2017,17 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi return undefined; } + private onDidChangeWCO(): void { + const bannerFirst = this.workbenchGrid.getNeighborViews(this.titleBarPartView, Direction.Up, false).length > 0; + const shouldBannerBeFirst = this.shouldShowBannerFirst(); + + if (bannerFirst !== shouldBannerBeFirst) { + this.workbenchGrid.moveView(this.bannerPartView, Sizing.Distribute, this.titleBarPartView, shouldBannerBeFirst ? Direction.Up : Direction.Down); + } + + this.workbenchGrid.setViewVisible(this.titleBarPartView, this.shouldShowTitleBar()); + } + private arrangeEditorNodes(nodes: { editor: ISerializedNode; sideBar?: ISerializedNode; auxiliaryBar?: ISerializedNode }, availableHeight: number, availableWidth: number): ISerializedNode { if (!nodes.sideBar && !nodes.auxiliaryBar) { nodes.editor.size = availableHeight; @@ -2187,7 +2207,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi type: 'branch', size: width, data: [ - ...(isWeb ? titleAndBanner.reverse() : titleAndBanner), + ...(this.shouldShowBannerFirst() ? titleAndBanner.reverse() : titleAndBanner), { type: 'branch', data: middleSection, |