13
0

remove HYPER,SUPER,META modifier masks from Keyboard::RelevantModifierMask so that modifier_state_equals() works on OS X

GTK on OS X adds META when Command is pressed even though it also uses MOD2 to indicate COMMAND. So Cmd-w was actually META-MOD2-w and modifier_state_equals(MOD2)
would fail. This should have nothing but good side effects
This commit is contained in:
Paul Davis 2016-02-18 09:44:50 -05:00
parent dd7649a409
commit c92e822332

View File

@ -143,6 +143,18 @@ Keyboard::Keyboard ()
RelevantModifierKeyMask = (GdkModifierType) gtk_accelerator_get_default_mod_mask ();
#ifdef __APPLE__
/* Remove SUPER,HYPER,META.
*
* GTK on OS X adds META when Command is pressed for various indefensible reasons, since
* it also uses MOD2 to indicate Command.
*/
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask & ~GDK_SUPER_MASK);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask & ~GDK_HYPER_MASK);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask & ~GDK_META_MASK);
#endif
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | PrimaryModifier);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | SecondaryModifier);
RelevantModifierKeyMask = GdkModifierType (RelevantModifierKeyMask | TertiaryModifier);