From b55c5d8e93c5239d77e9afc1e15b2c7e9449d40e Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 14 Nov 2020 18:34:20 +0200 Subject: macOS: Disable menu shortcuts while binding keys --- src/macos.m | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/macos.m') diff --git a/src/macos.m b/src/macos.m index 28ebcc43..24a6fecb 100644 --- a/src/macos.m +++ b/src/macos.m @@ -491,6 +491,15 @@ void setupApplication_MacOS(void) { windowCloseItem.action = @selector(closeTab); } +void enableMenu_MacOS(const char *menuLabel, iBool enable) { + NSApplication *app = [NSApplication sharedApplication]; + NSMenu *appMenu = [app mainMenu]; + NSString *label = [NSString stringWithUTF8String:menuLabel]; + NSMenuItem *menuItem = [appMenu itemAtIndex:[appMenu indexOfItemWithTitle:label]]; + [menuItem setEnabled:enable]; + [label release]; +} + void insertMenuItems_MacOS(const char *menuLabel, int atIndex, const iMenuItem *items, size_t count) { NSApplication *app = [NSApplication sharedApplication]; MyDelegate *myDel = (MyDelegate *) app.delegate; -- cgit v1.2.3