Bug 659602 - Provide an abstraction for the platform's use of modifier keys
Add enum GdkModifierIntent which identifies use cases for modifier masks and GdkKeyMap::get_modifier_mask(). Add a default implementation which returns what is currently hardcoded all over GTK+, and an implementation in the quartz backend. Also add gtk_widget_get_modifier_mask() which simplifies things by doing widget->display->keymap->get_modifier_mask().
This commit is contained in:
committed by
Michael Natterer
parent
04009aa332
commit
4a7a67339a
@ -746,6 +746,32 @@ gdk_quartz_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
gdk_quartz_keymap_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent)
|
||||
{
|
||||
switch (intent)
|
||||
{
|
||||
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
|
||||
return GDK_MOD2_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
|
||||
return GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
|
||||
return GDK_SHIFT_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
|
||||
return GDK_MOD2_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
|
||||
return GDK_MOD2_MASK | GDK_CONTROL_MASK;
|
||||
|
||||
default:
|
||||
g_return_val_if_reached (0);
|
||||
}
|
||||
}
|
||||
|
||||
/* What sort of key event is this? Returns one of
|
||||
* GDK_KEY_PRESS, GDK_KEY_RELEASE, GDK_NOTHING (should be ignored)
|
||||
*/
|
||||
@ -835,4 +861,5 @@ gdk_quartz_keymap_class_init (GdkQuartzKeymapClass *klass)
|
||||
keymap_class->translate_keyboard_state = gdk_quartz_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_quartz_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_quartz_keymap_map_virtual_modifiers;
|
||||
keymap_class->get_modifier_mask = gdk_quartz_keymap_get_modifier_mask;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user