From 9f3a9ef02de17704b5d9cd9b5d3d674788d23a8d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 18 Jul 2016 14:42:13 -0400 Subject: [PATCH] before pushing keybindings to GTK for menu display, make sure that we add back the META modifer that GTK expects --- libs/gtkmm2ext/bindings.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libs/gtkmm2ext/bindings.cc b/libs/gtkmm2ext/bindings.cc index ff44da4b32..7d7d4ed0a6 100644 --- a/libs/gtkmm2ext/bindings.cc +++ b/libs/gtkmm2ext/bindings.cc @@ -597,7 +597,20 @@ Bindings::push_to_gtk (KeyboardKey kb, RefPtr what) * happens. */ - Gtk::AccelMap::add_entry (what->get_accel_path(), kb.key(), (Gdk::ModifierType) kb.state()); + + int mod = kb.state(); +#ifdef __APPLE__ + /* See comments in Keyboard::Keyboard about GTK handling of MOD2, META and the Command key. + * + * If we do not do this, GTK+ won't show the correct text for shortcuts in menus. + */ + + if (mod & GDK_MOD2_MASK) { + mod = mod | GDK_META_MASK; + } +#endif + + Gtk::AccelMap::add_entry (what->get_accel_path(), kb.key(), (Gdk::ModifierType) mod); } }