Skip to content

fix: Set native menus per-window#8444

Merged
yaoweiprc merged 1 commit into
Kong:developfrom
Stedoss:fix/unique-menu-windows
Mar 24, 2025
Merged

fix: Set native menus per-window#8444
yaoweiprc merged 1 commit into
Kong:developfrom
Stedoss:fix/unique-menu-windows

Conversation

@Stedoss

@Stedoss Stedoss commented Mar 9, 2025

Copy link
Copy Markdown
Contributor

Resolves #8399.

Previously when a new window was created Menu.setApplicationMenu() was called, which would change all windows' native menu to the newly created one - causing every window menu to reference the newly created BrowserWindow. This causes weird behaviour with old windows (see Before video).

Now each window is set their own Menu instance which will have their own BrowserWindow.

Note

This mostly impacts Windows and Linux, may need some testing on Mac to make sure behaviour is still as expected.

Before

electron_yApfFkBxZg.mp4

After

iPiHNTZGTX.mp4

@CLAassistant

CLAassistant commented Mar 9, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Kong Kong deleted a comment from CLAassistant Mar 13, 2025
@notjaywu notjaywu requested a review from yaoweiprc March 20, 2025 03:16
Previously when a new window was created `Menu.setApplicationMenu()` was
called, which would change all windows' native menu to the newly created
one - causing every window menu to reference the newly created
`BrowserWindow`.

Now each window is set their own `Menu` instance which will have their
own `BrowserWindow`.
@yaoweiprc

Copy link
Copy Markdown
Contributor

Thank you for submitting the PR. You have a deep understanding of Electron. I believe this PR can fix more hidden issues. @Stedoss

@yaoweiprc yaoweiprc enabled auto-merge (squash) March 24, 2025 08:22
@yaoweiprc yaoweiprc merged commit 357dbb9 into Kong:develop Mar 24, 2025
cwangsmv pushed a commit that referenced this pull request Apr 21, 2025
Previously when a new window was created `Menu.setApplicationMenu()` was
called, which would change all windows' native menu to the newly created
one - causing every window menu to reference the newly created
`BrowserWindow`.

Now each window is set their own `Menu` instance which will have their
own `BrowserWindow`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resizing window to FHD

3 participants