summaryrefslogtreecommitdiff
path: root/gtk/gtkimcontextsimple.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-04-05 14:40:55 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-04-06 15:13:54 -0400
commit0a96a483c696d6620a6e08ff97cebc0f5b90ac47 (patch)
treef7beb2a7fa97e3d4d9ff509111ab9eb563240f8b /gtk/gtkimcontextsimple.c
parent50713677942b7917af52ce4bc5aa3cb8f8cd9528 (diff)
downloadgtk+-0a96a483c696d6620a6e08ff97cebc0f5b90ac47.tar.gz
gdk: Redo key events
Add all of the keyboard translation results in the key event, so we can translate the keyboard state at the time the event is created, and avoid doing state translation at match time. We actually need to carry two sets of translation results, since we ignore CapsLock when matching accelerators, in gdk_event_matches(). At the same time, drop the scancode field - it is only ever set on win32, and is basically unused in GTK. Update all callers.
Diffstat (limited to 'gtk/gtkimcontextsimple.c')
-rw-r--r--gtk/gtkimcontextsimple.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index b5b868c7c0..061fae5d10 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -929,18 +929,21 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
for (i = 0; i < n_compose - len - 1; i++)
{
- guint tmp_keyval = priv->compose_buffer[len + i];
+ GdkTranslatedKey translated;
+ translated.keyval = priv->compose_buffer[len + i];
+ translated.consumed = 0;
+ translated.layout = 0;
+ translated.level = 0;
GdkEvent *tmp_event = gdk_event_key_new (GDK_KEY_PRESS,
gdk_event_get_surface (event),
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_time (event),
+ priv->compose_buffer[len + i],
gdk_event_get_modifier_state (event),
- tmp_keyval,
- tmp_keyval,
- tmp_keyval,
- 0,
- 0);
+ FALSE,
+ &translated,
+ &translated);
gtk_im_context_filter_keypress (context, tmp_event);
gdk_event_unref (tmp_event);
@@ -997,7 +1000,7 @@ canonical_hex_keyval (GdkEvent *event)
* any other state, and return that hex keyval if so
*/
gdk_display_map_keycode (gdk_event_get_display (event),
- gdk_key_event_get_scancode (event),
+ gdk_key_event_get_keycode (event),
NULL,
&keyvals, &n_vals);