Skip to content

feat: support system-context-menu on Linux#45848

Merged
codebytere merged 1 commit intomainfrom
support-system-context-menu-linux
Apr 1, 2025
Merged

feat: support system-context-menu on Linux#45848
codebytere merged 1 commit intomainfrom
support-system-context-menu-linux

Conversation

@codebytere
Copy link
Copy Markdown
Member

Description of Change

Closes #45799.
Refs CL:6231191

Adds support for system-context-menu to Linux, allowing developers to conditionally show the native context menu in non-client regions.

cc @bpasero

Checklist

Release Notes

Notes: Added support for system-context-menu on Linux.

@codebytere codebytere added semver/minor backwards-compatible functionality target/35-x-y PR should also be added to the "35-x-y" branch. labels Feb 28, 2025
@codebytere codebytere force-pushed the support-system-context-menu-linux branch from 52a787c to 02856b2 Compare February 28, 2025 09:57
@deepak1556
Copy link
Copy Markdown
Member

Had a small question on Point value,

On windows we are not returning the result in DIP today

NotifyWindowSystemContextMenu(GET_X_LPARAM(l_param),
GET_Y_LPARAM(l_param), &prevent_default);
, wonder how it is on linux. We should align the results in both cases

@codebytere
Copy link
Copy Markdown
Member Author

@deepak1556 looks like this likewise doesn't return the results in DIP -

https://gist.github.com/eab26d265b7944b5f026ff8fa20e4ab1 shows:

system-context-menu triggered at: { x: 338, y: 239 }
screen.getCursorScreenPoint() result: { x: 690, y: 335 }

For the same right-click. My thought here is we should leave both non-DIP and ensure documentation notes potential need to correct for DIP coordinates.

@deepak1556
Copy link
Copy Markdown
Member

My thought here is we should leave both non-DIP and ensure documentation notes potential need to correct for DIP coordinates.

Agreed.

Some more notes, x11 and wayland uses different scale factors to get the cursor screen point

x11 - https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/x11/x11_screen_ozone.cc;l=54-61
wayland - https://source.chromium.org/chromium/chromium/src/+/main:ui/ozone/platform/wayland/host/wayland_screen.cc;l=340-353

We would need to confirm which API to expose on linux, for windows we have https://github.com/electron/electron/blob/main/docs/api/screen.md#screenscreentodippointpoint-windows

@codebytere codebytere marked this pull request as draft March 4, 2025 19:54
@github-actions github-actions bot added the target/36-x-y PR should also be added to the "36-x-y" branch. label Mar 5, 2025
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Mar 7, 2025
@codebytere codebytere force-pushed the support-system-context-menu-linux branch from 02856b2 to f46d097 Compare March 24, 2025 08:51
@codebytere codebytere marked this pull request as ready for review March 24, 2025 08:52
@codebytere codebytere force-pushed the support-system-context-menu-linux branch from f46d097 to 430d1f9 Compare March 24, 2025 09:08
@codebytere codebytere requested a review from deepak1556 March 24, 2025 11:13
Copy link
Copy Markdown
Member

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

Copy link
Copy Markdown
Member

@samuelmaddock samuelmaddock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@codebytere codebytere force-pushed the support-system-context-menu-linux branch from 430d1f9 to ba99981 Compare March 28, 2025 13:57
Copy link
Copy Markdown
Member

@itsananderson itsananderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API LGTM

@codebytere codebytere merged commit 5da75c4 into main Apr 1, 2025
59 checks passed
@codebytere codebytere deleted the support-system-context-menu-linux branch April 1, 2025 09:00
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Apr 1, 2025

Release Notes Persisted

Added support for system-context-menu on Linux.

@trop
Copy link
Copy Markdown
Contributor

trop bot commented Apr 1, 2025

I have automatically backported this PR to "36-x-y", please check out #46399

@trop trop bot added in-flight/36-x-y and removed target/36-x-y PR should also be added to the "36-x-y" branch. labels Apr 1, 2025
@trop
Copy link
Copy Markdown
Contributor

trop bot commented Apr 1, 2025

I have automatically backported this PR to "35-x-y", please check out #46400

@trop trop bot added in-flight/35-x-y merged/36-x-y PR was merged to the "36-x-y" branch. and removed target/35-x-y PR should also be added to the "35-x-y" branch. in-flight/36-x-y labels Apr 1, 2025
@trop trop bot removed the in-flight/35-x-y label Apr 17, 2025
@trop
Copy link
Copy Markdown
Contributor

trop bot commented May 7, 2025

@deepak1556 has manually backported this PR to "35-x-y", please check out #46977

@trop trop bot added in-flight/35-x-y merged/35-x-y PR was merged to the "35-x-y" branch. and removed in-flight/35-x-y labels May 7, 2025
kigh-ota pushed a commit to kigh-ota/electron that referenced this pull request Sep 30, 2025
feat: support system-context-menu on Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review/approved ✅ merged/35-x-y PR was merged to the "35-x-y" branch. merged/36-x-y PR was merged to the "36-x-y" branch. semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux: allow to show the native OS title menu in frameless windows

6 participants