[gtk] gdk_quartz_keymap_translate_keyboard_state fills consumed_modifiers incorrectly (closes #2102)
- From: Alex Samorukov <asamorukov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] gdk_quartz_keymap_translate_keyboard_state fills consumed_modifiers incorrectly (closes #2102)
- Date: Fri, 10 Jan 2020 21:19:16 +0000 (UTC)
commit f0cbd175cdf1f7655c0c0ce3beb3eadc9b4c97e4
Author: Alex Samorukov <samm os2 kiev ua>
Date: Fri Jan 10 22:18:24 2020 +0100
gdk_quartz_keymap_translate_keyboard_state fills consumed_modifiers
incorrectly (closes #2102)
See merge request GNOME/gtk!1225
gdk/quartz/gdkkeys-quartz.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/gdk/quartz/gdkkeys-quartz.c b/gdk/quartz/gdkkeys-quartz.c
index f9857831c9..6ded6b1a34 100644
--- a/gdk/quartz/gdkkeys-quartz.c
+++ b/gdk/quartz/gdkkeys-quartz.c
@@ -680,7 +680,6 @@ gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
{
guint tmp_keyval;
GdkModifierType bit;
- guint tmp_modifiers = 0;
if (keyval)
*keyval = 0;
@@ -694,24 +693,23 @@ gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
if (hardware_keycode < 0 || hardware_keycode >= NUM_KEYCODES)
return FALSE;
+ tmp_keyval = translate_keysym (hardware_keycode, group, state, level, effective_group);
+
/* Check if modifiers modify the keyval */
- for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
+ if (consumed_modifiers)
{
- 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;
- }
+ guint tmp_modifiers = (state & GDK_MODIFIER_MASK);
- tmp_keyval = translate_keysym (hardware_keycode, group, state, level, effective_group);
+ 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;
+ }
- if (consumed_modifiers)
- *consumed_modifiers = tmp_modifiers;
+ *consumed_modifiers = tmp_modifiers;
+ }
if (keyval)
*keyval = tmp_keyval;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]