wpesrc: Convert from utf32 to support other keys

This makes all of the non-letter keys work.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2156>
This commit is contained in:
Olivier Crête 2022-04-11 15:56:19 -05:00 committed by GStreamer Marge Bot
parent 3ca61ae0d3
commit 41967e503c

View file

@ -586,10 +586,18 @@ gst_wpe_video_src_event (GstBaseSrc * base_src, GstEvent * event)
if (gst_navigation_event_parse_key_event (event, &key)) {
/* FIXME: This is wrong... The GstNavigation API should pass
hardware-level information, not high-level keysym strings */
uint32_t keysym =
(uint32_t) xkb_keysym_from_name (key, XKB_KEYSYM_NO_FLAGS);
gunichar *unichar;
glong items_written;
uint32_t keysym;
struct wpe_input_keyboard_event wpe_event = { 0 };
unichar = g_utf8_to_ucs4_fast (key, -1, &items_written);
if (items_written == 1)
keysym = (uint32_t) xkb_utf32_to_keysym (*unichar);
else
keysym =
(uint32_t) xkb_keysym_from_name (key, XKB_KEYSYM_NO_FLAGS);
wpe_event.key_code = keysym;
wpe_event.pressed =
gst_navigation_event_get_type (event) ==