Skip to content

Commit ce2b88b

Browse files
authored
fix system context menu handler is not registered (microsoft#155533)
* fix system context menu handler is not registered * fix hygiene
1 parent 665487a commit ce2b88b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -196,19 +196,19 @@ export class TitlebarPart extends BrowserTitleBarPart {
196196

197197
this._register(this.layoutService.onDidChangeWindowMaximized(maximized => this.onDidChangeWindowMaximized(maximized)));
198198
this.onDidChangeWindowMaximized(this.layoutService.isWindowMaximized());
199+
}
199200

200-
// Window System Context Menu
201-
// See https://github.com/electron/electron/issues/24893
202-
if (isWindows) {
203-
this._register(this.nativeHostService.onDidTriggerSystemContextMenu(({ windowId, x, y }) => {
204-
if (this.nativeHostService.windowId !== windowId) {
205-
return;
206-
}
207-
208-
const zoomFactor = getZoomFactor();
209-
this.onContextMenu(new MouseEvent('mouseup', { clientX: x / zoomFactor, clientY: y / zoomFactor }), MenuId.TitleBarContext);
210-
}));
211-
}
201+
// Window System Context Menu
202+
// See https://github.com/electron/electron/issues/24893
203+
if (isWindows && getTitleBarStyle(this.configurationService) === 'custom') {
204+
this._register(this.nativeHostService.onDidTriggerSystemContextMenu(({ windowId, x, y }) => {
205+
if (this.nativeHostService.windowId !== windowId) {
206+
return;
207+
}
208+
209+
const zoomFactor = getZoomFactor();
210+
this.onContextMenu(new MouseEvent('mouseup', { clientX: x / zoomFactor, clientY: y / zoomFactor }), MenuId.TitleBarContext);
211+
}));
212212
}
213213

214214
return ret;

0 commit comments

Comments
 (0)