From f2170f0a2ff71fae149396ef8c70c74d40722c5e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 12 Dec 2019 23:46:54 +0100 Subject: [PATCH] VKeybd: fix MacOS key-bindings --- gtk2_ardour/pianokeyboard.cc | 12 ++++++++++-- 1 file 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)); }