diff options
author | Dudemanguy <random342@airmail.cc> | 2023-07-24 09:51:10 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-07-24 17:07:27 +0000 |
commit | 48eb77207bff01ae766a9fb33b4e4c35cfad62c9 (patch) | |
tree | a7928e199e20e21ab9a615f698108ccfdd9d8b22 /video | |
parent | 9e449cc685fd0635ebed906acda0446b43db2f59 (diff) | |
download | mpv-48eb77207bff01ae766a9fb33b4e4c35cfad62c9.tar.bz2 mpv-48eb77207bff01ae766a9fb33b4e4c35cfad62c9.tar.xz |
wayland: restore xkb_keysym_to_utf8 handling
In 1f8013ff3fddd788a517656e09f5ce5d7efd928d, I mistakenly thought this
was only used for modifier presses way back in the commit it was
introduced in, but it actually also handles non-english keys/letters.
Instead of returning early, we should try xkb_keysym_to_utf8 first and
then return if that doesn't do anything so the modifier can then be
handled in the appropriate event. Fixes #12009.
Diffstat (limited to 'video')
-rw-r--r-- | video/out/wayland_common.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 799dad543f..2e6722c8c2 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -436,15 +436,20 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *wl_keyboard, xkb_keysym_t sym = xkb_state_key_get_one_sym(wl->xkb_state, wl->keyboard_code); int mpkey = lookupkey(sym); - // Assume a modifier was pressed and handle it in the mod event instead. - if (!mpkey && MP_KEY_STATE_DOWN) - return; - state = state == WL_KEYBOARD_KEY_STATE_PRESSED ? MP_KEY_STATE_DOWN : MP_KEY_STATE_UP; - if (mpkey) + if (mpkey) { mp_input_put_key(wl->vo->input_ctx, mpkey | state | wl->mpmod); + } else { + char s[128]; + if (xkb_keysym_to_utf8(sym, s, sizeof(s)) > 0) { + mp_input_put_key_utf8(wl->vo->input_ctx, state | wl->mpmod, bstr0(s)); + } else { + // Assume a modifier was pressed and handle it in the mod event instead. + return; + } + } if (state == MP_KEY_STATE_DOWN) wl->mpkey = mpkey; if (wl->mpkey == mpkey && state == MP_KEY_STATE_UP) |