Skip to content
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

Merged
merged 3 commits into from
Jul 21, 2022

Conversation

sbatten
Copy link
Member

@sbatten sbatten commented Jul 20, 2022

refs #155276

I've added comments and checks for when the mouse is not within the bounds of the title bar

@sbatten sbatten enabled auto-merge (squash) July 20, 2022 15:24
@sbatten sbatten self-assigned this Jul 20, 2022
@vscodenpa vscodenpa added this to the July 2022 milestone Jul 20, 2022
Copy link
Member

@bpasero bpasero left a 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.

@bpasero
Copy link
Member

bpasero commented Jul 20, 2022

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?

Copy link
Member

@bpasero bpasero left a 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?

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);
}));

@sbatten sbatten changed the title removing unnecessary enablements make system context menu code more understandable Jul 20, 2022
@sbatten sbatten merged commit 6246902 into main Jul 21, 2022
@sbatten sbatten deleted the sbatten/primitive-anaconda branch July 21, 2022 04:20
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants