mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2024-12-23 19:31:30 +11:00
Fixed shortcuts on Mac
This commit is contained in:
parent
42ce3b9286
commit
25ed203497
|
@ -90,7 +90,7 @@ fn main() {
|
|||
|
||||
let mut menu = Menu::new("TestMenu").unwrap();
|
||||
|
||||
menu.add_item(&MenuItem::new("Item 1", 1));
|
||||
menu.add_item(&MenuItem::new("Item 1", 1).shortcut(Key::S, 0));
|
||||
menu.add_item(&MenuItem::new("Item 2", 2));
|
||||
menu.add_item(&MenuItem::new("Item 3", 3));
|
||||
|
||||
|
|
|
@ -372,11 +372,11 @@ uint64_t mfb_add_menu_item(
|
|||
}
|
||||
|
||||
if (key != 0x7f) {
|
||||
NSString* key = convert_key_code_to_string(key);
|
||||
NSString* key_string = convert_key_code_to_string(key);
|
||||
|
||||
if (key) {
|
||||
if (key_string) {
|
||||
[newItem setKeyEquivalentModifierMask: mask];
|
||||
[newItem setKeyEquivalent:key];
|
||||
[newItem setKeyEquivalent:key_string];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -191,6 +191,7 @@ extern {
|
|||
fn mfb_add_menu_item(menu_item: *mut c_void,
|
||||
menu_id: i32,
|
||||
name: *const c_char,
|
||||
enabled: bool,
|
||||
key: u32,
|
||||
modifier: u32) -> u64;
|
||||
fn mfb_remove_menu_item(menu: *mut c_void, item_handle: u64);
|
||||
|
@ -623,7 +624,9 @@ impl Menu {
|
|||
println!("key {:?} conv {}", item.key, conv_key);
|
||||
|
||||
MenuItemHandle(mfb_add_menu_item(self.menu_handle, item.id as i32, item_name.as_ptr(),
|
||||
Self::map_key_to_menu_key(item.key), item.modifier))
|
||||
item.enabled,
|
||||
Self::map_key_to_menu_key(item.key),
|
||||
item.modifier))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue