summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-11-23 17:21:22 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-11-23 17:21:22 +0000
commit58a9b0f2decb21d45f70def9a2660da039599f93 (patch)
tree73a7de4bf34e5d648748a1e925e667cc0d1b0dea /gtk2_ardour
parentad8240f5c1c200b2da9c6d83440d00cfc3a539c9 (diff)
fix up Meta/Mod2/Command madness for OS X
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@10796 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/keyboard.cc8
-rw-r--r--gtk2_ardour/option_editor.cc12
-rw-r--r--gtk2_ardour/utils.cc99
3 files changed, 18 insertions, 101 deletions
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<string,string> dict;
- dict.push_back (pair ("<Meta>", "<Mod2>"));
- (void) PBD::file_subst (path, dict);
+ dict.insert (pair<string,string> ("<Meta>", "<Mod2>"));
+ 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-<key>. change the keyval back to what it would be without
- the alt key. this way, we see <alt>-v rather than <alt>-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