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

[StatusIndicator] Switch API to use Texture2D instead of Image, improve handling on macOS, add method to set native popup menu directly. #89588

Merged
merged 1 commit into from
May 1, 2024

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Mar 16, 2024

  • Switches API to use Texture2D instead of Image (as most other UI element do, breaking change from the previous dev release, but API was not present in any previous stable releases).
  • Improve event handling and icon scaling on macOS.
  • Add method (to DisplayServer and property to StatusIndicator node) to set native popup menu directly, since this is a most common use for indicators (also to match https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem/ for the future Linux implementation which might miss other ways to position popup).

@bruvzg bruvzg added this to the 4.3 milestone Mar 16, 2024
@bruvzg bruvzg marked this pull request as ready for review March 17, 2024 10:11
@bruvzg bruvzg requested review from a team as code owners March 17, 2024 10:11
Comment on lines 1192 to 1194
[b]Note:[/b] On macOS, menu is activated by any mouse button, activation callback is not triggered.
[b]Note:[/b] On Windows, menu is activated by right mouse button, selecting icon and pressing Shift+F10 or the applications key, activation callback for the other mouse buttons is still triggered.
[b]Note:[/b] Native popup is supported only if [NativeMenu] supports [constant NativeMenu.FEATURE_POPUP_MENU] feature.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[b]Note:[/b] On macOS, menu is activated by any mouse button, activation callback is not triggered.
[b]Note:[/b] On Windows, menu is activated by right mouse button, selecting icon and pressing Shift+F10 or the applications key, activation callback for the other mouse buttons is still triggered.
[b]Note:[/b] Native popup is supported only if [NativeMenu] supports [constant NativeMenu.FEATURE_POPUP_MENU] feature.
[b]Note:[/b] On macOS, the menu is activated by any mouse button. Its activation callback is [i]not[/i] triggered.
[b]Note:[/b] On Windows, the menu is activated by the right mouse button, selecting the status icon and pressing [kbd]Shift + F10[/kbd], or the applications key. The menu's activation callback for the other mouse buttons is still triggered.
[b]Note:[/b] Native popup is only supported if [NativeMenu] supports the [constant NativeMenu.FEATURE_POPUP_MENU] feature.

... What's the "selecting icon" and "applications key" though?

Copy link
Member Author

Choose a reason for hiding this comment

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

"applications key" though?

This thing (it's referred in the Windows docs as "applications key").
appkey

What's the "selecting icon"

You can select tray icons with keyboard (using Windows + B, arrow keys and Enter).

Copy link
Contributor

Choose a reason for hiding this comment

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

You learn something new every day... It may be worth mentioning the KEY_* constant equivalent if it does exist.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting, I always thought this was the context key.

doc/classes/StatusIndicator.xml Outdated Show resolved Hide resolved
…ve handling on macOS, add method to set native popup menu directly.
@akien-mga akien-mga requested a review from Riteo April 29, 2024 10:51
Copy link
Contributor

@Riteo Riteo left a comment

Choose a reason for hiding this comment

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

Looks fine!

I'm not very experienced with the MacOS and Windows stuff but no obvious red flags appear.

I can also see, if I understand correctly, that you used the native popup menu API for MacOS, which is great!

@akien-mga akien-mga merged commit 85062e3 into godotengine:master May 1, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants