changes to adapt to modified version of GTK/Quartz which uses only MOD2 for Command, everywhere.

The default version of GTK2/Quartz uses MOD2+META for keys and MOD2 for scroll, which is
basically insane
This commit is contained in:
Paul Davis 2016-12-13 06:22:51 -05:00
parent b34a614df4
commit 545f5bee87
3 changed files with 3 additions and 25 deletions

View File

@ -177,18 +177,6 @@ KeyboardKey::display_label () const
uint32_t mod = state();
#ifdef __APPLE__
/* We use both bits (MOD2|META) for Primary on OS X,
* but we don't want MOD2 showing up in listings. So remove
* it and add back META.
*/
if (mod & GDK_MOD2_MASK) {
mod = (mod & ~GDK_MOD2_MASK) | GDK_META_MASK;
}
#endif
return gtk_accelerator_get_label (key(), (GdkModifierType) mod);
}
@ -601,16 +589,6 @@ Bindings::push_to_gtk (KeyboardKey kb, RefPtr<Action> what)
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);
}

View File

@ -878,9 +878,9 @@ 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) */
/* our modified gdk/quartz maps Command to Mod2 */
if (key->accel_mods & GDK_META_MASK) {
if (key->accel_mods & GDK_MOD2_MASK) {
modifiers |= NSCommandKeyMask;
}
}

View File

@ -60,7 +60,7 @@ guint Keyboard::insert_note_mod = GDK_CONTROL_MASK;
#ifdef __APPLE__
uint Keyboard::PrimaryModifier = (GDK_MOD2_MASK|GDK_META_MASK); // Command
guint Keyboard::PrimaryModifier = GDK_MOD2_MASK; // Command
guint Keyboard::SecondaryModifier = GDK_CONTROL_MASK; // Control
guint Keyboard::TertiaryModifier = GDK_SHIFT_MASK; // Shift
guint Keyboard::Level4Modifier = GDK_MOD1_MASK; // Alt/Option