Skip to content

make system context menu code more understandable - #155747

Merged
SteVen Batten (sbatten) merged 3 commits into
mainfrom
sbatten/primitive-anaconda
Jul 21, 2022
Merged

SteVen Batten (sbatten) merged 3 commits into
mainfrom
sbatten/primitive-anaconda

Conversation

@sbatten

@sbatten SteVen Batten (sbatten) commented Jul 20, 2022 •

Copy link
Copy Markdown
Member

refs #155276

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

@bpasero Benjamin Pasero (bpasero) left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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?

@bpasero Benjamin Pasero (bpasero) left a comment

Copy link
Copy Markdown
Contributor

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 SteVen Batten (sbatten) changed the title removing unnecessary enablements make system context menu code more understandable Jul 20, 2022
@sbatten
SteVen Batten (sbatten) merged commit 6246902 into main Jul 21, 2022
@sbatten
SteVen Batten (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