Skip to content

Commit

Permalink
fix system context menu handler is not registered (#155533)
Browse files Browse the repository at this point in the history
* fix system context menu handler is not registered

* fix hygiene
  • Loading branch information
sbatten committed Jul 18, 2022
1 parent 665487a commit ce2b88b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,19 @@ export class TitlebarPart extends BrowserTitleBarPart {

this._register(this.layoutService.onDidChangeWindowMaximized(maximized => this.onDidChangeWindowMaximized(maximized)));
this.onDidChangeWindowMaximized(this.layoutService.isWindowMaximized());
}

// Window System Context Menu
// See https://github.com/electron/electron/issues/24893
if (isWindows) {
this._register(this.nativeHostService.onDidTriggerSystemContextMenu(({ windowId, x, y }) => {
if (this.nativeHostService.windowId !== windowId) {
return;
}

const zoomFactor = getZoomFactor();
this.onContextMenu(new MouseEvent('mouseup', { clientX: x / zoomFactor, clientY: y / zoomFactor }), MenuId.TitleBarContext);
}));
}
// Window System Context Menu
// See https://github.com/electron/electron/issues/24893
if (isWindows && getTitleBarStyle(this.configurationService) === 'custom') {
this._register(this.nativeHostService.onDidTriggerSystemContextMenu(({ windowId, x, y }) => {
if (this.nativeHostService.windowId !== windowId) {
return;
}

const zoomFactor = getZoomFactor();
this.onContextMenu(new MouseEvent('mouseup', { clientX: x / zoomFactor, clientY: y / zoomFactor }), MenuId.TitleBarContext);
}));
}

return ret;
Expand Down

0 comments on commit ce2b88b

Please sign in to comment.