summaryrefslogtreecommitdiff
path: root/gtk2_ardour/pianokeyboard.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-12-12 23:46:54 +0100
committerRobin Gareus <robin@gareus.org>2019-12-12 23:59:37 +0100
commitf2170f0a2ff71fae149396ef8c70c74d40722c5e (patch)
treef4464c9f36fff482da4ef9ff52a6278961404aae /gtk2_ardour/pianokeyboard.cc
parent1b91615b2c366c8bc0db6f689084a5f2a86bbe05 (diff)
VKeybd: fix MacOS key-bindings
Diffstat (limited to 'gtk2_ardour/pianokeyboard.cc')
-rw-r--r--gtk2_ardour/pianokeyboard.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/gtk2_ardour/pianokeyboard.cc b/gtk2_ardour/pianokeyboard.cc
index baf31c3005..6aef86ee26 100644
--- a/gtk2_ardour/pianokeyboard.cc
+++ b/gtk2_ardour/pianokeyboard.cc
@@ -536,15 +536,23 @@ APianoKeyboard::bind_keys_basic_qwertz ()
static char*
get_keycode (GdkEventKey* event)
{
- GdkKeymapKey kk;
-
/* We're not using event->keyval, because we need keyval with level set to 0.
E.g. if user holds Shift and presses '7', we want to get a '7', not '&'. */
+
+#ifdef __APPLE__
+ /* gdkkeys-quartz.c does not implement gdk_keymap_lookup_key */
+ guint keyval;
+ gdk_keymap_translate_keyboard_state (NULL, event->hardware_keycode,
+ (GdkModifierType)0, 0,
+ &keyval, NULL, NULL, NULL);
+#else
+ GdkKeymapKey kk;
kk.keycode = event->hardware_keycode;
kk.level = 0;
kk.group = 0;
guint keyval = gdk_keymap_lookup_key (NULL, &kk);
+#endif
return gdk_keyval_name (gdk_keyval_to_lower (keyval));
}