diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc index aadade264c..92ff3f894a 100644 --- a/gtk2_ardour/keyboard.cc +++ b/gtk2_ardour/keyboard.cc @@ -621,8 +621,12 @@ Keyboard::load_keybindings (string path) any Meta entries to Mod2 */ std::map dict; - dict.push_back (pair ("", "")); - (void) PBD::file_subst (path, dict); + dict.insert (pair ("", "")); + if (PBD::file_subst (path, dict)) { + cerr << string_compose (_("Your keybindings will be wrong. The file %1 needs to be editable by Ardour to update it"), + path) + << endl; + } #endif try { diff --git a/gtk2_ardour/option_editor.cc b/gtk2_ardour/option_editor.cc index 56044b00c8..7b5ecd5233 100644 --- a/gtk2_ardour/option_editor.cc +++ b/gtk2_ardour/option_editor.cc @@ -1145,18 +1145,18 @@ static const struct { #ifdef GTKOSX - /* Command = Meta + /* Command = Mod2 Option/Alt = Mod1 */ { "Shift", GDK_SHIFT_MASK }, - { "Command", GDK_META_MASK }, + { "Command", GDK_MOD2_MASK }, { "Control", GDK_CONTROL_MASK }, { "Option", GDK_MOD1_MASK }, - { "Command-Shift", GDK_MOD1_MASK|GDK_SHIFT_MASK }, - { "Command-Option", GDK_MOD1_MASK|GDK_MOD5_MASK }, - { "Shift-Option", GDK_SHIFT_MASK|GDK_MOD5_MASK }, - { "Shift-Command-Option", GDK_MOD5_MASK|GDK_SHIFT_MASK|GDK_MOD1_MASK }, + { "Command-Shift", GDK_MOD2_MASK|GDK_SHIFT_MASK }, + { "Command-Option", GDK_MOD2_MASK|GDK_MOD1_MASK }, + { "Shift-Option", GDK_SHIFT_MASK|GDK_MOD1_MASK }, + { "Shift-Command-Option", GDK_MOD1_MASK|GDK_SHIFT_MASK|GDK_MOD2_MASK }, #else { "Shift", GDK_SHIFT_MASK }, diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 7fadf0e28a..d9f78302de 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -410,73 +410,6 @@ relay_key_press (GdkEventKey* ev, Gtk::Window* win) } } -#ifdef GTKOSX -static guint -osx_keyval_without_alt (guint accent_keyval) -{ - switch (accent_keyval) { - case GDK_oe: - return GDK_q; - case GDK_registered: - return GDK_r; - case GDK_dagger: - return GDK_t; - case GDK_yen: - return GDK_y; - case GDK_diaeresis: - return GDK_u; - case GDK_oslash: - return GDK_o; - case GDK_Greek_pi: - return GDK_p; - case GDK_leftdoublequotemark: - return GDK_bracketleft; - case GDK_leftsinglequotemark: - return GDK_bracketright; - case GDK_guillemotleft: - return GDK_backslash; - case GDK_aring: - return GDK_a; - case GDK_ssharp: - return GDK_s; - case GDK_partialderivative: - return GDK_d; - case GDK_function: - return GDK_f; - case GDK_copyright: - return GDK_g; - case GDK_abovedot: - return GDK_h; - case GDK_notsign: - return GDK_l; - case GDK_ellipsis: - return GDK_semicolon; - case GDK_ae: - return GDK_apostrophe; - case GDK_Greek_OMEGA: - return GDK_z; - case GDK_ccedilla: - return GDK_c; - case GDK_radical: - return GDK_v; - case GDK_integral: - return GDK_b; - case GDK_mu: - return GDK_m; - case GDK_lessthanequal: - return GDK_comma; - case GDK_greaterthanequal: - return GDK_period; - case GDK_division: - return GDK_slash; - default: - break; - } - - return GDK_VoidSymbol; -} -#endif - bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) { @@ -485,17 +418,18 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) bool special_handling_of_unmodified_accelerators = false; bool allow_activating = true; -// #define DEBUG_ACCELERATOR_HANDLING +#define DEBUG_ACCELERATOR_HANDLING #ifdef DEBUG_ACCELERATOR_HANDLING - //bool debug = (getenv ("ARDOUR_DEBUG_ACCELERATOR_HANDLING") != 0); - bool debug=true; + bool debug = (getenv ("ARDOUR_DEBUG_ACCELERATOR_HANDLING") != 0); #endif if (focus) { if (GTK_IS_ENTRY(focus) || Keyboard::some_magic_widget_has_focus()) { special_handling_of_unmodified_accelerators = true; } #ifdef DEBUG_ACCELERATOR_HANDLING - cerr << "Focus widget name " << gtk_widget_get_name(focus) << endl; + if (debug) { + cerr << "Focus widget name " << gtk_widget_get_name(focus) << endl; + } #endif } @@ -513,7 +447,7 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) << " alt/mod1 " << ((ev->state & GDK_MOD1_MASK) ? 1 : 0) << " mod2 " << ((ev->state & GDK_MOD2_MASK) ? 1 : 0) << " shift " << ((ev->state & GDK_SHIFT_MASK) ? 1 : 0) - << " cmd/meta " << ((ev->state & GDK_META_MASK) ? 1 : 0) + << " meta " << ((ev->state & GDK_META_MASK) ? 1 : 0) << " lock " << ((ev->state & GDK_LOCK_MASK) ? 1 : 0) << " special handling ? " << special_handling_of_unmodified_accelerators @@ -556,27 +490,6 @@ key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev) all "normal text" accelerators. */ -#ifdef GTKOSX - if (!special_handling_of_unmodified_accelerators) { - if (ev->state & GDK_MOD1_MASK) { - /* we're not in a text entry or "magic focus" widget so we don't want OS X "special-character" - text-style handling of alt-. change the keyval back to what it would be without - the alt key. this way, we see -v rather than -radical and so on. - */ - guint keyval_without_alt = osx_keyval_without_alt (ev->keyval); - - if (keyval_without_alt != GDK_VoidSymbol) { -#ifdef DEBUG_ACCELERATOR_HANDLING - cerr << "Remapped " << gdk_keyval_name (ev->keyval) << " to " << gdk_keyval_name (keyval_without_alt) << endl; - -#endif - ev->keyval = keyval_without_alt; - ev->group = 0; - } - } - } -#endif - if (!special_handling_of_unmodified_accelerators) { /* pretend that certain key events that GTK does not allow diff --git a/libs/gtkmm2ext/gtkapplication_quartz.mm b/libs/gtkmm2ext/gtkapplication_quartz.mm index 03051849d3..ebb88cc1f5 100644 --- a/libs/gtkmm2ext/gtkapplication_quartz.mm +++ b/libs/gtkmm2ext/gtkapplication_quartz.mm @@ -870,9 +870,7 @@ cocoa_menu_item_update_accelerator (NSMenuItem *cocoa_item, modifiers |= NSControlKeyMask; } - /* gdk/quartz maps Command to Meta (XXX check this - it may move to SUPER at some point) */ - - if (key->accel_mods & GDK_META_MASK) { + if (key->accel_mods & GDK_MOD2_MASK) { modifiers |= NSCommandKeyMask; } } diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc index 5d228e1821..3404b7274d 100644 --- a/libs/gtkmm2ext/pixfader.cc +++ b/libs/gtkmm2ext/pixfader.cc @@ -28,7 +28,7 @@ using namespace Gdk; using namespace std; #ifdef GTKOSX -int PixFader::fine_scale_modifier = GDK_META_MASK; +int PixFader::fine_scale_modifier = GDK_MOD2_MASK; #else int PixFader::fine_scale_modifier = GDK_CONTROL_MASK; #endif