提交 9849693b 编写于 作者: S SteVen Batten

fixes #53479

上级 15facaa9
......@@ -51,6 +51,11 @@
overflow: visible;
}
.monaco-workbench.windows > .part.titlebar > .window-title,
.monaco-workbench.linux > .part.titlebar > .window-title {
cursor: default;
}
.monaco-workbench.linux > .part.titlebar > .window-title {
font-size: inherit;
}
......
......@@ -112,6 +112,7 @@ export class MenubarControl extends Disposable {
private mnemonics: Map<KeyCode, number>;
private _onVisibilityChange: Emitter<boolean>;
private _onFocusStateChange: Emitter<boolean>;
private static MAX_MENU_RECENT_ENTRIES = 10;
......@@ -152,6 +153,7 @@ export class MenubarControl extends Disposable {
}));
this._onVisibilityChange = this._register(new Emitter<boolean>());
this._onFocusStateChange = this._register(new Emitter<boolean>());
if (isMacintosh || this.currentTitlebarStyleSetting !== 'custom') {
for (let topLevelMenuName of Object.keys(this.topLevelMenus)) {
......@@ -305,6 +307,7 @@ export class MenubarControl extends Disposable {
}
this._focusState = value;
this._onFocusStateChange.fire(this.focusState >= MenubarState.FOCUSED);
}
private get mnemonicsInUse(): boolean {
......@@ -793,11 +796,6 @@ export class MenubarControl extends Disposable {
e.stopPropagation();
}));
this._register(DOM.addDisposableListener(this.customMenus[menuIndex].buttonElement, DOM.EventType.CLICK, (e) => {
e.preventDefault();
e.stopPropagation();
}));
this._register(DOM.addDisposableListener(this.customMenus[menuIndex].buttonElement, DOM.EventType.MOUSE_ENTER, () => {
if (this.isOpen && !this.isCurrentMenu(menuIndex)) {
this.customMenus[menuIndex].buttonElement.focus();
......@@ -836,8 +834,8 @@ export class MenubarControl extends Disposable {
}
}));
this._register(DOM.addDisposableListener(window, DOM.EventType.CLICK, () => {
// This click is outside the menubar so it counts as a focus out
this._register(DOM.addDisposableListener(window, DOM.EventType.MOUSE_DOWN, () => {
// This mouse event is outside the menubar so it counts as a focus out
if (this.isFocused) {
this.setUnfocusedState();
}
......@@ -1105,6 +1103,10 @@ export class MenubarControl extends Disposable {
return this._onVisibilityChange.event;
}
public get onFocusStateChange(): Event<boolean> {
return this._onFocusStateChange.event;
}
public layout(dimension: DOM.Dimension) {
if (this.container) {
this.container.style.height = `${dimension.height}px`;
......
......@@ -134,6 +134,16 @@ export class TitlebarPart extends Part implements ITitleService {
}
}
private onMenubarFocusChanged(focused: boolean) {
if (isWindows || isLinux) {
if (focused) {
hide(this.dragRegion);
} else {
show(this.dragRegion);
}
}
}
onMenubarVisibilityChange(): Event<boolean> {
return this.menubarPart.onVisibilityChange;
}
......@@ -285,6 +295,7 @@ export class TitlebarPart extends Part implements ITitleService {
if (!isMacintosh) {
this._register(this.menubarPart.onVisibilityChange(e => this.onMenubarVisibilityChanged(e)));
this._register(this.menubarPart.onFocusStateChange(e => this.onMenubarFocusChanged(e)));
}
// Title
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册