From 545f5bee87062c33ce5aa7bb0fecfbdd1cb1a83b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 13 Dec 2016 06:22:51 -0500 Subject: [PATCH] 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 --- libs/gtkmm2ext/bindings.cc | 22 ---------------------- libs/gtkmm2ext/gtkapplication_quartz.mm | 4 ++-- libs/gtkmm2ext/keyboard.cc | 2 +- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/libs/gtkmm2ext/bindings.cc b/libs/gtkmm2ext/bindings.cc index 9100ddabc6..2b1762da90 100644 --- a/libs/gtkmm2ext/bindings.cc +++ b/libs/gtkmm2ext/bindings.cc @@ -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 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); } diff --git a/libs/gtkmm2ext/gtkapplication_quartz.mm b/libs/gtkmm2ext/gtkapplication_quartz.mm index 5809355ad9..c845db90b7 100644 --- a/libs/gtkmm2ext/gtkapplication_quartz.mm +++ b/libs/gtkmm2ext/gtkapplication_quartz.mm @@ -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; } } diff --git a/libs/gtkmm2ext/keyboard.cc b/libs/gtkmm2ext/keyboard.cc index 6417596dad..69f682642c 100644 --- a/libs/gtkmm2ext/keyboard.cc +++ b/libs/gtkmm2ext/keyboard.cc @@ -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 -- 2.30.2