mirror of
https://github.com/mpv-player/mpv
synced 2025-01-08 16:10:29 +00:00
wayland: restore xkb_keysym_to_utf8 handling
In 1f8013ff3f
, 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.
This commit is contained in:
parent
9e449cc685
commit
48eb77207b
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user