mirror of
https://github.com/italicsjenga/rust_minifb.git
synced 2025-01-11 03:21:32 +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();
|
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 2", 2));
|
||||||
menu.add_item(&MenuItem::new("Item 3", 3));
|
menu.add_item(&MenuItem::new("Item 3", 3));
|
||||||
|
|
||||||
|
|
|
@ -372,11 +372,11 @@ uint64_t mfb_add_menu_item(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key != 0x7f) {
|
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 setKeyEquivalentModifierMask: mask];
|
||||||
[newItem setKeyEquivalent:key];
|
[newItem setKeyEquivalent:key_string];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,7 @@ extern {
|
||||||
fn mfb_add_menu_item(menu_item: *mut c_void,
|
fn mfb_add_menu_item(menu_item: *mut c_void,
|
||||||
menu_id: i32,
|
menu_id: i32,
|
||||||
name: *const c_char,
|
name: *const c_char,
|
||||||
|
enabled: bool,
|
||||||
key: u32,
|
key: u32,
|
||||||
modifier: u32) -> u64;
|
modifier: u32) -> u64;
|
||||||
fn mfb_remove_menu_item(menu: *mut c_void, item_handle: 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);
|
println!("key {:?} conv {}", item.key, conv_key);
|
||||||
|
|
||||||
MenuItemHandle(mfb_add_menu_item(self.menu_handle, item.id as i32, item_name.as_ptr(),
|
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