mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
fix menubar visibility events when moving menubar (#153179)
fixes #151063
This commit is contained in:
parent
551cf46204
commit
09c5a6ed48
|
@ -746,7 +746,7 @@ export class MenuBar extends Disposable {
|
|||
this._onFocusStateChange.fire(this.focusState >= MenubarState.FOCUSED);
|
||||
}
|
||||
|
||||
private get isVisible(): boolean {
|
||||
get isVisible(): boolean {
|
||||
return this.focusState >= MenubarState.VISIBLE;
|
||||
}
|
||||
|
||||
|
|
|
@ -698,6 +698,11 @@ export class CustomMenubarControl extends MenubarControl {
|
|||
}));
|
||||
|
||||
this.reinstallDisposables.add(attachMenuStyler(this.menubar, this.themeService));
|
||||
|
||||
// Fire visibility change for the first install if menu is shown
|
||||
if (this.menubar.isVisible) {
|
||||
this.onDidVisibilityChange(true);
|
||||
}
|
||||
} else {
|
||||
this.menubar?.update(this.getMenuBarOptions());
|
||||
}
|
||||
|
|
|
@ -180,7 +180,9 @@ export class TitlebarPart extends Part implements ITitleService {
|
|||
|
||||
protected onMenubarVisibilityChanged(visible: boolean): void {
|
||||
if (isWeb || isWindows || isLinux) {
|
||||
this.adjustTitleMarginToCenter();
|
||||
if (this.lastLayoutDimensions) {
|
||||
this.layout(this.lastLayoutDimensions.width, this.lastLayoutDimensions.height);
|
||||
}
|
||||
|
||||
this._onMenubarVisibilityChange.fire(visible);
|
||||
}
|
||||
|
@ -197,6 +199,8 @@ export class TitlebarPart extends Part implements ITitleService {
|
|||
this.menubar.remove();
|
||||
this.menubar = undefined;
|
||||
}
|
||||
|
||||
this.onMenubarVisibilityChanged(false);
|
||||
}
|
||||
|
||||
protected installMenubar(): void {
|
||||
|
@ -210,9 +214,9 @@ export class TitlebarPart extends Part implements ITitleService {
|
|||
this.menubar = this.rootContainer.insertBefore($('div.menubar'), this.title);
|
||||
this.menubar.setAttribute('role', 'menubar');
|
||||
|
||||
this.customMenubar.create(this.menubar);
|
||||
|
||||
this._register(this.customMenubar.onVisibilityChange(e => this.onMenubarVisibilityChanged(e)));
|
||||
|
||||
this.customMenubar.create(this.menubar);
|
||||
}
|
||||
|
||||
private updateTitle(): void {
|
||||
|
|
Loading…
Reference in a new issue