feat: add support for associating a Menu with a WebFrameMain (#45138)
* feat: add support for associating a Menu with a WebFrameMain This allows certain OS level features to activate such as Writing Tools, Autofill.. and Services. There appears to be a bug in macOS where the responder chain isn't traversed if the menu is not popped up using an event, as such we spoof a fake mouse event at the write coordinates in the right window and use that to open the menu. * build: fix build on non-mac * build: oops missed a header * fix: safely handle optional T* by checking nullptr too * build: fix gn check and build errors * docs: suggested changes * feat: default `frame` to `window.webContents.mainFrame` when possible * fix: avoid deref nullptr view * Revert "feat: default `frame` to `window.webContents.mainFrame` when possible" This reverts commit 2e888368199317d67f6ad931a7e9eff0295c4b1b. * fix: lint * Remove redundant scoped objects This code, including the comments, matches almost exactly the behavior of this argument to the function. * Add ScopedPumpMessagesInPrivateModes patch * More null pointer safety --------- Co-authored-by: clavin <clavin@electronjs.org>
This commit is contained in:
parent
46b108e9a4
commit
49aba471dc
12 changed files with 104 additions and 16 deletions
2
typings/internal-electron.d.ts
vendored
2
typings/internal-electron.d.ts
vendored
|
@ -166,7 +166,7 @@ declare namespace Electron {
|
|||
commandsMap: Record<string, MenuItem>;
|
||||
groupsMap: Record<string, MenuItem[]>;
|
||||
getItemCount(): number;
|
||||
popupAt(window: BaseWindow, x: number, y: number, positioning: number, sourceType: Required<Electron.PopupOptions>['sourceType'], callback: () => void): void;
|
||||
popupAt(window: BaseWindow, frame: WebFrameMain | undefined, x: number, y: number, positioning: number, sourceType: Required<Electron.PopupOptions>['sourceType'], callback: () => void): void;
|
||||
closePopupAt(id: number): void;
|
||||
setSublabel(index: number, label: string): void;
|
||||
setToolTip(index: number, tooltip: string): void;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue