Desktop: Mac native menu bar (#3301)

* macos native menu bar

* fix nix build

* Add shortcut symbols to menu

* fix fmt

* fix vendoring

* cleanup intercept frontend message

* accept into editor message in queue function
This commit is contained in:
Timon
2025-10-27 14:11:24 +00:00
committed by GitHub
parent 6ca25e4ea9
commit 5be9b1fabc
22 changed files with 458 additions and 45 deletions
+17 -5
View File
@@ -1,11 +1,15 @@
use winit::event_loop::ActiveEventLoop;
use winit::window::{Window, WindowAttributes};
use super::NativeWindow;
use crate::consts::APP_NAME;
use crate::event::AppEventScheduler;
use crate::wrapper::messages::MenuItem;
pub(super) struct NativeWindowImpl {}
pub(super) struct NativeWindowImpl {
menu: menu::Menu,
}
impl NativeWindow for NativeWindowImpl {
impl super::NativeWindow for NativeWindowImpl {
fn configure(attributes: WindowAttributes, _event_loop: &dyn ActiveEventLoop) -> WindowAttributes {
let mac_window = winit::platform::macos::WindowAttributesMacOS::default()
.with_titlebar_transparent(true)
@@ -14,7 +18,15 @@ impl NativeWindow for NativeWindowImpl {
attributes.with_platform_attributes(Box::new(mac_window))
}
fn new(_window: &dyn Window) -> Self {
NativeWindowImpl {}
fn new(_window: &dyn Window, app_event_scheduler: AppEventScheduler) -> Self {
let menu = menu::Menu::new(app_event_scheduler, APP_NAME);
NativeWindowImpl { menu }
}
fn update_menu(&self, entries: Vec<MenuItem>) {
self.menu.update(entries);
}
}
mod menu;