forked from AuroraMiddleware/gtk
gdk: quartz: fix #2102 consumed_modifiers
This commit is contained in:
parent
61d7700c17
commit
af6487d70c
@ -648,7 +648,6 @@ gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
|||||||
{
|
{
|
||||||
guint tmp_keyval;
|
guint tmp_keyval;
|
||||||
GdkModifierType bit;
|
GdkModifierType bit;
|
||||||
guint tmp_modifiers = 0;
|
|
||||||
|
|
||||||
if (keyval)
|
if (keyval)
|
||||||
*keyval = 0;
|
*keyval = 0;
|
||||||
@ -662,24 +661,23 @@ gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
|||||||
if (hardware_keycode < 0 || hardware_keycode >= NUM_KEYCODES)
|
if (hardware_keycode < 0 || hardware_keycode >= NUM_KEYCODES)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Check if modifiers modify the keyval */
|
|
||||||
for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
|
|
||||||
{
|
|
||||||
if (translate_keysym (hardware_keycode,
|
|
||||||
(bit == GDK_MOD1_MASK) ? 0 : group,
|
|
||||||
state & ~bit,
|
|
||||||
NULL, NULL) !=
|
|
||||||
translate_keysym (hardware_keycode,
|
|
||||||
(bit == GDK_MOD1_MASK) ? 1 : group,
|
|
||||||
state | bit,
|
|
||||||
NULL, NULL))
|
|
||||||
tmp_modifiers |= bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmp_keyval = translate_keysym (hardware_keycode, group, state, level, effective_group);
|
tmp_keyval = translate_keysym (hardware_keycode, group, state, level, effective_group);
|
||||||
|
|
||||||
|
/* Check if modifiers modify the keyval */
|
||||||
if (consumed_modifiers)
|
if (consumed_modifiers)
|
||||||
*consumed_modifiers = tmp_modifiers;
|
{
|
||||||
|
guint tmp_modifiers = (state & GDK_MODIFIER_MASK);
|
||||||
|
|
||||||
|
for (bit = 1; bit <= tmp_modifiers; bit <<= 1)
|
||||||
|
{
|
||||||
|
if ((bit & tmp_modifiers) &&
|
||||||
|
translate_keysym (hardware_keycode, group, state & ~bit,
|
||||||
|
NULL, NULL) == tmp_keyval)
|
||||||
|
tmp_modifiers &= ~bit;
|
||||||
|
}
|
||||||
|
|
||||||
|
*consumed_modifiers = tmp_modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
if (keyval)
|
if (keyval)
|
||||||
*keyval = tmp_keyval;
|
*keyval = tmp_keyval;
|
||||||
|
Loading…
Reference in New Issue
Block a user