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

[macOS] Add about_to_open and popup_hide callback for the global menus. #79361

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Jul 12, 2023

  • Adds about_to_open and popup_hide callback for the global menus
  • Move part of logic to the PopupMenu to allow live menu modification

Fixes #79349

@bruvzg bruvzg added this to the 4.x milestone Jul 12, 2023
@bruvzg bruvzg force-pushed the mac_gl_menu_signals branch 2 times, most recently from a538857 to 81947ac Compare July 13, 2023 08:27
@Riteo
Copy link
Contributor

Riteo commented Jul 15, 2023

Actually, if I'm understanding correctly, a popup_hide DisplayServer callback would be great for popups in general because on Wayland popups close by themselves when unfocusing or something else like locking the screen, resorting me to force a WINDOW_EVENT_CLOSE_REQUEST to them hoping that they get cleaned up.

That said, I have no idea how much the global menu logic differs from normal window logic so I have no idea if this is possible.

@bruvzg
Copy link
Member Author

bruvzg commented Jul 18, 2023

Actually, if I'm understanding correctly, a popup_hide DisplayServer callback would be great for popups in general because on Wayland popups close by themselves when unfocusing or something else like locking the screen, resorting me to force a WINDOW_EVENT_CLOSE_REQUEST to them hoping that they get cleaned up.

Global menu do not use any of the window logic. Popup auto closeing on the rest of the platforms do the same, send WINDOW_EVENT_CLOSE_REQUEST.

@bruvzg bruvzg marked this pull request as ready for review July 18, 2023 11:32
@bruvzg bruvzg requested review from a team as code owners July 18, 2023 11:32
@Riteo
Copy link
Contributor

Riteo commented Jul 18, 2023

@bruvzg

Global menu do not use any of the window logic. Popup auto closeing on the rest of the platforms do the same, send WINDOW_EVENT_CLOSE_REQUEST.

Oh all right so that is the right way, nevermind, I thought for some reason that it was an hack.

Edit: Just to be clear, by hack I meant an hack in my Wayland implementation.

@brunosxs
Copy link
Contributor

brunosxs commented Aug 3, 2023

You need to override the global_menu_add_item() on all display servers as right now this can create lots of warnings on the console.

@bruvzg
Copy link
Member Author

bruvzg commented Aug 3, 2023

You need to override the global_menu_add_item() on all display servers as right now this can create lots of warnings on the console.

It should not be called on DisplayServer that doesn't support it, but one check was missing. Should be fixed now.

@bruvzg bruvzg force-pushed the mac_gl_menu_signals branch 2 times, most recently from 6c206bf to 3fd3925 Compare September 4, 2023 08:39
@YuriSizov YuriSizov modified the milestones: 4.x, 4.2 Sep 6, 2023
…menus, move part of logic to the PopupMenu to allow live menu modification.
@akien-mga akien-mga merged commit 425b000 into godotengine:master Oct 4, 2023
15 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.

MacOS: native topbar menu does not emit about_to_popup signal
5 participants