diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2017-07-01 15:23:35 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2017-07-01 15:23:35 +0000 |
| commit | 99f6cc63e8ea435147e0cae5707c55e2637bb972 (patch) | |
| tree | c798f9c421c33de23a355e0600809ac5b41cd1ad /src/shortcuts.cpp | |
| parent | Fix version strings to work on windows & unix (diff) | |
| download | inkscape-99f6cc63e8ea435147e0cae5707c55e2637bb972.tar.gz inkscape-99f6cc63e8ea435147e0cae5707c55e2637bb972.zip | |
Runtime check for primary accelerator
Diffstat (limited to 'src/shortcuts.cpp')
| -rw-r--r-- | src/shortcuts.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp index 8a8d36d5a..708e58198 100644 --- a/src/shortcuts.cpp +++ b/src/shortcuts.cpp @@ -626,11 +626,17 @@ static void read_shortcuts_file(char const *filename, bool const is_user_set) { } else if (!strcmp(mod, "Meta")) { modifiers |= SP_SHORTCUT_META_MASK; } else if (!strcmp(mod, "Primary")) { -#ifdef __APPLE__ - modifiers |= SP_SHORTCUT_META_MASK; -#else - modifiers |= SP_SHORTCUT_CONTROL_MASK; -#endif + GdkModifierType mod = + gdk_keymap_get_modifier_mask (gdk_keymap_get_default(), GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR); + gdk_keymap_add_virtual_modifiers(gdk_keymap_get_default(), &mod); + if (mod & GDK_CONTROL_MASK) + modifiers |= SP_SHORTCUT_CONTROL_MASK; + else if (mod & GDK_META_MASK) + modifiers |= SP_SHORTCUT_META_MASK; + else { + g_warning("unsupported primary accelerator "); + modifiers |= SP_SHORTCUT_CONTROL_MASK; + } } else { g_warning("Unknown modifier %s for %s", mod, verb_name); } |
