diff options
author | David Robillard <d@drobilla.net> | 2015-01-14 20:31:38 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-01-14 20:31:38 -0500 |
commit | 4166b05bdacd2e77352c4eb4e960146f338df0c3 (patch) | |
tree | 79f540c29d21d29bc01642874133ed5e232b5e3c /gtk2_ardour | |
parent | af1a064ebf196a883a4dd3c2eefe373796abd3f6 (diff) |
Fix setting command key bindings on OSX.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/keyeditor.cc | 5 | ||||
-rw-r--r-- | gtk2_ardour/utils.cc | 19 |
2 files changed, 5 insertions, 19 deletions
diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc index 85522a7e41..f8b5f2da4e 100644 --- a/gtk2_ardour/keyeditor.cc +++ b/gtk2_ardour/keyeditor.cc @@ -203,11 +203,14 @@ KeyEditor::on_key_release_event (GdkEventKey* ev) goto out; } + GdkModifierType mod = (GdkModifierType)(Keyboard::RelevantModifierKeyMask & ev->state); + Gtkmm2ext::possibly_translate_keyval_to_make_legal_accelerator (ev->keyval); + Gtkmm2ext::possibly_translate_mod_to_make_legal_accelerator (mod); bool result = AccelMap::change_entry (path, last_keyval, - ModifierType (Keyboard::RelevantModifierKeyMask & ev->state), + Gdk::ModifierType(mod), true); if (result) { diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index c9d3abe111..a88ee7f9a5 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -450,24 +450,7 @@ ARDOUR_UI_UTILS::key_press_focus_accelerator_handler (Gtk::Window& window, GdkEv GdkModifierType mod = GdkModifierType (ev->state); mod = GdkModifierType (mod & gtk_accelerator_get_default_mod_mask()); -#ifdef GTKOSX - /* GTK on OS X is currently (February 2012) setting both - the Meta and Mod2 bits in the event modifier state if - the Command key is down. - - gtk_accel_groups_activate() does not invoke any of the logic - that gtk_window_activate_key() will that sorts out that stupid - state of affairs, and as a result it fails to find a match - for the key event and the current set of accelerators. - - to fix this, if the meta bit is set, remove the mod2 bit - from the modifier. this assumes that our bindings use Primary - which will have set the meta bit in the accelerator entry. - */ - if (mod & GDK_META_MASK) { - mod = GdkModifierType (mod & ~GDK_MOD2_MASK); - } -#endif + Gtkmm2ext::possibly_translate_mod_to_make_legal_accelerator(mod); if (allow_activating && gtk_accel_groups_activate(G_OBJECT(win), fakekey, mod)) { DEBUG_TRACE (DEBUG::Accelerators, "\taccel group activated by fakekey\n"); |