Use the private GdkKeyEvent.translated_key getter

We can avoid poking directly at the GdkKeyEvent structure, now.
This commit is contained in:
Emmanuele Bassi 2020-05-22 12:37:37 +01:00
parent 0cf5b66e7b
commit d68e312c2b

View File

@ -1244,8 +1244,8 @@ static GdkEvent *
rewrite_event_for_toplevel (GdkEvent *event) rewrite_event_for_toplevel (GdkEvent *event)
{ {
GdkSurface *surface; GdkSurface *surface;
GdkKeyEvent *key_event;
GdkEventType event_type; GdkEventType event_type;
GdkTranslatedKey *key, *key_no_lock;
surface = gdk_event_get_surface (event); surface = gdk_event_get_surface (event);
if (!surface->parent) if (!surface->parent)
@ -1259,9 +1259,9 @@ rewrite_event_for_toplevel (GdkEvent *event)
while (surface->parent) while (surface->parent)
surface = surface->parent; surface = surface->parent;
key_event = (GdkKeyEvent *) event; key = gdk_key_event_get_translated_key (event, FALSE);
key_no_lock = gdk_key_event_get_translated_key (event, TRUE);
/* FIXME: Avoid direct access to the translated[] field */
return gdk_key_event_new (gdk_event_get_event_type (event), return gdk_key_event_new (gdk_event_get_event_type (event),
surface, surface,
gdk_event_get_device (event), gdk_event_get_device (event),
@ -1270,8 +1270,7 @@ rewrite_event_for_toplevel (GdkEvent *event)
gdk_key_event_get_keycode (event), gdk_key_event_get_keycode (event),
gdk_event_get_modifier_state (event), gdk_event_get_modifier_state (event),
gdk_key_event_is_modifier (event), gdk_key_event_is_modifier (event),
&key_event->translated[0], key, key_no_lock);
&key_event->translated[1]);
} }
static gboolean static gboolean