From d1548176e227df3840c644a8a9d384b14fc842f8 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Mon, 29 Mar 2021 08:40:49 +0300 Subject: macOS: Fixed missing menu shortcuts The built-in alternate bindings shouldn't affect the menu shortcuts. --- src/macos.m | 4 ++-- src/ui/keys.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/macos.m b/src/macos.m index 0dcc3ef5..61507b6f 100644 --- a/src/macos.m +++ b/src/macos.m @@ -497,7 +497,7 @@ void insertMenuItems_MacOS(const char *menuLabel, int atIndex, const iMenuItem * [myDel setCommand:[NSString stringWithUTF8String:items[i].command] forMenuItem:item]; /* Bindings may have a different key. */ const iBinding *bind = findCommand_Keys(items[i].command); - if (bind) { + if (bind && bind->id < builtIn_BindingId) { key = bind->key; kmods = bind->mods; } @@ -533,7 +533,7 @@ void handleCommand_MacOS(const char *cmd) { if (command) { const iBinding *bind = findCommand_Keys( [command cStringUsingEncoding:NSUTF8StringEncoding]); - if (bind) { + if (bind && bind->id < builtIn_BindingId) { setShortcut_NSMenuItem_(menuItem, bind->key, bind->mods); } } diff --git a/src/ui/keys.h b/src/ui/keys.h index 90e33b7c..4cbca3b7 100644 --- a/src/ui/keys.h +++ b/src/ui/keys.h @@ -56,6 +56,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ # define subscribeToPage_KeyModifier SDLK_d, KMOD_SHIFT | KMOD_PRIMARY #endif +#define builtIn_BindingId 1000 /* not user-configurable */ + iDeclareType(Binding) struct Impl_Binding { -- cgit v1.2.3