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

Add nsmenu title #1846

Merged
merged 8 commits into from
Jul 27, 2021
5 changes: 3 additions & 2 deletions druid-shell/src/backend/mac/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use cocoa::appkit::{NSEventModifierFlags, NSMenu, NSMenuItem};
use cocoa::base::{id, nil, NO};
use cocoa::foundation::NSAutoreleasePool;
use cocoa::foundation::{NSAutoreleasePool, NSString};
use objc::{msg_send, sel, sel_impl};

use super::util::make_nsstring;
Expand Down Expand Up @@ -59,7 +59,8 @@ fn make_menu_item(id: u32, text: &str, key: Option<&HotKey>, enabled: bool, sele
impl Menu {
pub fn new() -> Menu {
unsafe {
let menu = NSMenu::alloc(nil).autorelease();
let title = NSString::alloc(nil).init_str("").autorelease();
let menu = NSMenu::alloc(nil).initWithTitle_(title).autorelease();
let () = msg_send![menu, setAutoenablesItems: NO];
Menu { menu }
}
Expand Down