Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aux window - fix zoom when title bar prevents it #202378

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { onDidChangeFullscreen } from 'vs/base/browser/browser';
import { onDidChangeFullscreen, onDidChangeZoomLevel } from 'vs/base/browser/browser';
import { detectFullscreen, hide, show } from 'vs/base/browser/dom';
import { Emitter, Event } from 'vs/base/common/event';
import { DisposableStore } from 'vs/base/common/lifecycle';
Expand Down Expand Up @@ -113,6 +113,18 @@ export class AuxiliaryEditorPart {
titlebarPartVisible = true;

disposables.add(titlebarPart.onDidChange(() => updateEditorPartHeight(true)));
disposables.add(onDidChangeZoomLevel(targetWindowId => {
if (auxiliaryWindow.window.vscodeWindowId === targetWindowId && titlebarPartVisible) {

// This is a workaround for https://github.com/microsoft/vscode/issues/202377
// The title bar part prevents zooming in certain cases and when doing so,
// adjusts its size accordingly. This is however not reported from the
// `onDidchange` event that we listen to above, so we manually update the
// editor part height here.

updateEditorPartHeight(true);
}
}));

disposables.add(onDidChangeFullscreen(windowId => {
if (windowId !== auxiliaryWindow.window.vscodeWindowId) {
Expand Down
2 changes: 2 additions & 0 deletions src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class TitlebarPartHoverDelegate implements IHoverDelegate {
}

export class BrowserTitlebarPart extends Part implements ITitlebarPart {

//#region IView

readonly minimumWidth: number = 0;
Expand Down Expand Up @@ -826,6 +827,7 @@ export class AuxiliaryBrowserTitlebarPart extends BrowserTitlebarPart implements
}

override get preventZoom(): boolean {

// Prevent zooming behavior if any of the following conditions are met:
// 1. Shrinking below the window control size (zoom < 1)
// 2. No custom items are present in the main title bar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ export class AuxiliaryNativeTitlebarPart extends NativeTitlebarPart implements I
}

override get preventZoom(): boolean {

// Prevent zooming behavior if any of the following conditions are met:
// 1. Shrinking below the window control size (zoom < 1)
// 2. No custom items are present in the main title bar
Expand Down