-
Notifications
You must be signed in to change notification settings - Fork 29k
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
make system context menu code more understandable #155747
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot really review without understanding what exactly this code does. At the very very minimum, explain it in JSDoc comments.
Looks like its coming from https://docs.microsoft.com/en-us/windows/win32/menurc/wm-initmenu?redirectedfrom=MSDN. Is this the officially accepted solution from Electron? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we at least check if the context menu is triggered over the bounds of the title area?
vscode/src/vs/workbench/electron-sandbox/parts/titlebar/titlebarPart.ts
Lines 204 to 211 in 09259ab
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); | |
})); |
but comment them
refs #155276
I've added comments and checks for when the mouse is not within the bounds of the title bar