Files
Graphite/desktop/src/window/mac.rs
Timon 5be9b1fabc 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
2025-10-27 14:11:24 +00:00

33 lines
913 B
Rust

use winit::event_loop::ActiveEventLoop;
use winit::window::{Window, WindowAttributes};
use crate::consts::APP_NAME;
use crate::event::AppEventScheduler;
use crate::wrapper::messages::MenuItem;
pub(super) struct NativeWindowImpl {
menu: menu::Menu,
}
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)
.with_fullsize_content_view(true)
.with_title_hidden(true);
attributes.with_platform_attributes(Box::new(mac_window))
}
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;