Add MacOS menu (#1583)
* feat: added MacOS menu * fix: ran fmt * extracted function into variable * idiomatic formatting * Set the default menu only during app startup * Don't set the activation policy in the menu init Co-authored-by: Artur Kovacs <kovacs.artur.barnabas@gmail.com>
This commit is contained in:
parent
1c4d6e7613
commit
e8cdf8b092
4 changed files with 123 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ use crate::{
|
|||
platform_impl::platform::{
|
||||
event::{EventProxy, EventWrapper},
|
||||
event_loop::{post_dummy_event, PanicInfo},
|
||||
menu,
|
||||
observer::{CFRunLoopGetMain, CFRunLoopWakeUp, EventLoopWaker},
|
||||
util::{IdRef, Never},
|
||||
window::get_window_id,
|
||||
|
|
@ -274,6 +275,9 @@ impl AppState {
|
|||
pub fn launched() {
|
||||
HANDLER.set_ready();
|
||||
HANDLER.waker().start();
|
||||
// The menubar initialization should be before the `NewEvents` event, to allow overriding
|
||||
// of the default menu in the event
|
||||
menu::initialize();
|
||||
HANDLER.set_in_callback(true);
|
||||
HANDLER.handle_nonuser_event(EventWrapper::StaticEvent(Event::NewEvents(
|
||||
StartCause::Init,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue